Commit 10675857 authored by Fulvio Galeazzi's avatar Fulvio Galeazzi
Browse files

2018-04-03: FG; Added backfillfull threshold, get other thresholds from osd...

2018-04-03:  FG;  Added backfillfull threshold, get other thresholds from osd dump rather than pg dump.
parent 2449aded
......@@ -7,10 +7,12 @@ UserParameter=ceph.global.objsmis[*],/etc/zabbix/scripts/cephHealth.pl $1 --om
UserParameter=ceph.global.objsmisfrac[*],/etc/zabbix/scripts/cephHealth.pl $1 --om -f
UserParameter=ceph.global.rawsize[*],/etc/zabbix/scripts/cephUsage.pl $1
UserParameter=ceph.global.rawfrac[*],/etc/zabbix/scripts/cephUsage.pl $1 -f
UserParameter=ceph.global.thrbackfillfull[*],/etc/zabbix/scripts/cephHealth.pl $1 --backfillfullth
UserParameter=ceph.global.thrnearfull[*],/etc/zabbix/scripts/cephHealth.pl $1 --nearfullth
UserParameter=ceph.global.thrfull[*],/etc/zabbix/scripts/cephHealth.pl $1 --fullth
UserParameter=ceph.global.slowosd[*],/etc/zabbix/scripts/cephHealth.pl $1 --slowosd
UserParameter=ceph.global.slowreq[*],/etc/zabbix/scripts/cephHealth.pl $1 --slowreq
UserParameter=ceph.osd.backfillfull[*],/etc/zabbix/scripts/cephHealth.pl $1 --backfillfull
UserParameter=ceph.osd.nearfull[*],/etc/zabbix/scripts/cephHealth.pl $1 --nearfull
UserParameter=ceph.osd.full[*],/etc/zabbix/scripts/cephHealth.pl $1 --full
UserParameter=ceph.osd.down[*],/etc/zabbix/scripts/cephOsdStat.pl $1 -s down
......
......@@ -71,7 +71,7 @@ chomp $_sudo;
### Options
our($opt_exec, $opt_become, $opt_cluster, $opt_user, $opt_keyring, $opt_monhost,
$opt_status, $opt_slow_osd, $opt_slow_req, $opt_object_degraded, $opt_object_misplaced,
$opt_fraction, $opt_fullth, $opt_nearfullth, $opt_full, $opt_nearfull, $opt_filter, $opt_debug, $opt_h);
$opt_fraction, $opt_fullth, $opt_nearfullth, $opt_backfillfullth, $opt_full, $opt_nearfull, $opt_backfillfull, $opt_filter, $opt_debug, $opt_h);
if (@ARGV > 0) {
GetOptions("e=s"=>\$opt_exec,
"b" =>\$opt_become,
......@@ -87,8 +87,10 @@ if (@ARGV > 0) {
"f" =>\$opt_fraction,
"fullth" =>\$opt_fullth,
"nearfullth" =>\$opt_nearfullth,
"backfillfullth" =>\$opt_backfillfullth,
"full" =>\$opt_full,
"nearfull" =>\$opt_nearfull,
"backfillfull" =>\$opt_backfillfull,
"s=s"=>\$opt_filter,
"d" =>\$opt_debug,
"h" =>\$opt_h) || fail_usage;
......@@ -148,6 +150,10 @@ my $doOsdFull = 0;
if (defined $opt_full) {
$doOsdFull = 1;
}
my $doOsdBackfillFull = 0;
if (defined $opt_backfillfull) {
$doOsdBackfillFull = 1;
}
my $doOsdNearFull = 0;
if (defined $opt_nearfull) {
$doOsdNearFull = 1;
......@@ -160,19 +166,23 @@ my $doOsdNearFullth = 0;
if (defined $opt_nearfullth) {
$doOsdNearFullth = 1;
}
my $doOsdBackfillFullth = 0;
if (defined $opt_backfillfullth) {
$doOsdBackfillFullth = 1;
}
my @matchStr = ();
if (defined $opt_filter) {
@matchStr = split(/,/,$opt_filter);
}
#
my $sumDo = $doStatus + $doSlowOsd + $doSlowReq + $doObjectDeg + $doObjectMis + $doOsdFull + $doOsdNearFull + $doOsdFullth + $doOsdNearFullth;
my $sumDo = $doStatus + $doSlowOsd + $doSlowReq + $doObjectDeg + $doObjectMis + $doOsdBackfillFull + $doOsdFull + $doOsdNearFull + $doOsdBackfillFullth + $doOsdFullth + $doOsdNearFullth;
if ($sumDo > 1) {
fail_usage "Either status or slow_requests/osds or objectsDeg/objectsMis or OSD_full/OSD_nearfull or OSD_fullTh/OSD_nearfullTh.";
fail_usage "Either status or slow_requests/osds or objectsDeg/objectsMis or OSD_full/OSD_nearfull/OSD_backfillfull or OSD_fullTh/OSD_nearfullTh/OSD_backfillfullth.";
}
# Fetch the "pg dump" data and put it in an array
if ($doOsdFullth + $doOsdNearFullth) {
my @_pgdata = `$cephCmd pg dump 2> /dev/null`;
if ($doOsdFullth + $doOsdNearFullth + $doOsdBackfillFullth) {
my @_pgdata = `$cephCmd osd dump | head -20 2> /dev/null`;
chomp @_pgdata;
foreach my $_pgline (@_pgdata) {
if ($doOsdFullth) {
......@@ -185,6 +195,11 @@ if ($doOsdFullth + $doOsdNearFullth) {
print $1."\n";
exit 0;
}
} elsif ($doOsdBackfillFullth) {
if ($_pgline =~ m/^backfillfull\S+\s+([-+]?[0-9]*\.?[0-9]+)/) {
print $1."\n";
exit 0;
}
}
if ($_pgline =~ m/^\d+/) {
print "-1"."\n";
......@@ -214,6 +229,7 @@ my $objMisplaced = 0;
my $objMisplacedFrac = 0;
my $osdFull = 0;
my $osdNearFull = 0;
my $osdBackfillFull = 0;
# Read the array and print the wanted data
foreach my $_line (@_data)
{
......@@ -250,6 +266,8 @@ foreach my $_line (@_data)
$osdNearFull += 1;
} elsif ($_line =~ m/^osd.*is full/) {
$osdFull += 1;
} elsif ($_line =~ m/^osd.*is backfill full/) {
$osdBackfillFull += 1;
}
}
......@@ -273,6 +291,8 @@ if (defined $opt_status) {
print $numSlowOsd."\n";
} elsif (defined $opt_nearfull) {
print $osdNearFull."\n";
} elsif (defined $opt_backfillfull) {
print $osdBackfillFull."\n";
} elsif (defined $opt_full) {
print $osdFull."\n";
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment