mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-23 21:55:16 +02:00
fix #1049
adopt plugin to use B as units (closer to plugin coding guidelines) cleanup the output correct usage informatin git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@8877 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
4d13249926
commit
ebf7f75f61
@ -269,7 +269,7 @@ $Used = $result->{$OID_hrStorageUsed.".".$partition };
|
|||||||
# Plugins var treatmen
|
# Plugins var treatmen
|
||||||
|
|
||||||
if (!$Size){
|
if (!$Size){
|
||||||
print "Disk CRITICAL - no output (-p number expected... it doesn't exist, try another disk - number\n";
|
print "Disk CRITICAL - no output (-p number expected... it doesn't exist, try another disk number)\n";
|
||||||
exit $ERRORS{'CRITICAL'};
|
exit $ERRORS{'CRITICAL'};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,9 +294,8 @@ if (($Size =~ /([0-9]+)/) && ($AllocationUnits =~ /([0-9]+)/)){
|
|||||||
@test = split (/\./, $pourcent);
|
@test = split (/\./, $pourcent);
|
||||||
$pourcent = $test[0];
|
$pourcent = $test[0];
|
||||||
}
|
}
|
||||||
my $lastTot = $tot;
|
my $totMB = $tot / 1073741824;
|
||||||
$tot = $tot / 1073741824;
|
my $usedMB = $used / 1073741824;
|
||||||
$Used = ($Used * $AllocationUnits) / 1073741824;
|
|
||||||
|
|
||||||
# Plugin return code
|
# Plugin return code
|
||||||
|
|
||||||
@ -313,27 +312,17 @@ if (($Size =~ /([0-9]+)/) && ($AllocationUnits =~ /([0-9]+)/)){
|
|||||||
|
|
||||||
if ($hrStorageDescr){
|
if ($hrStorageDescr){
|
||||||
$hrStorageDescr =~ s/\ //g if (defined($opt_t) && $opt_t eq "AS400");
|
$hrStorageDescr =~ s/\ //g if (defined($opt_t) && $opt_t eq "AS400");
|
||||||
print $hrStorageDescr . " TOTAL: ";
|
my $warn = $opt_w * $tot;
|
||||||
printf("%.3f", $tot);
|
my $crit = $opt_c * $tot;
|
||||||
print " Go USED: " . $pourcent . "% : ";
|
printf($hrStorageDescr . " TOTAL: %.3fGB USED: %.3fGB (%d%%)", $totMB, $usedMB, $pourcent );
|
||||||
printf("%.3f", $Used);
|
print "|size=".$tot."B used=".$used."B;".$warn.";".$crit."\n";
|
||||||
print " Go";
|
|
||||||
my $size_o = $Used * 1073741824;
|
|
||||||
my $warn = $opt_w * $size_o;
|
|
||||||
my $crit = $opt_c * $size_o;
|
|
||||||
print "|size=".$lastTot."o used=".$size_o."o;".$warn.";".$crit;
|
|
||||||
print "\n";
|
|
||||||
exit $return_code;
|
exit $return_code;
|
||||||
} else {
|
} else {
|
||||||
print "TOTAL: ";
|
printf("TOTAL: %.3fGB USED: %.3fGB (%d%%)", $totMB, $usedMB, $pourcent );
|
||||||
printf("%.3f", $tot);
|
|
||||||
print " Go USED: " . $pourcent . "% : ";
|
|
||||||
printf("%.3f", $Used);
|
|
||||||
print " Go\n";
|
|
||||||
exit $return_code;
|
exit $return_code;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print "Disk CRITICAL - no output (-d number expected... it doesn't exist, try another disk - number\n";
|
print "Disk CRITICAL - no output (-d number expected... it doesn't exist, try another disk number)\n";
|
||||||
exit $ERRORS{'CRITICAL'};
|
exit $ERRORS{'CRITICAL'};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,10 +339,10 @@ sub print_usage () {
|
|||||||
print " -n (--name) Allows to use disk name with option -d instead of disk oid index\n";
|
print " -n (--name) Allows to use disk name with option -d instead of disk oid index\n";
|
||||||
print " (ex: -d \"C:\" -n, -d \"E:\" -n, -d \"Swap Memory\" -n, -d \"Real Memory\" -n\n";
|
print " (ex: -d \"C:\" -n, -d \"E:\" -n, -d \"Swap Memory\" -n, -d \"Real Memory\" -n\n";
|
||||||
print " (choose an unique expression for each disk)\n";
|
print " (choose an unique expression for each disk)\n";
|
||||||
print " -s (--show) Describes all disk (debug mode)\n";
|
print " -s (--show) Lists all disks (debug mode)\n";
|
||||||
print " -w (--warn) Signal strength at which a warning message will be generated\n";
|
print " -w (--warn) Minimum fill level at which a warning message will be generated\n";
|
||||||
print " (default 80)\n";
|
print " (default 80)\n";
|
||||||
print " -c (--crit) Signal strength at which a critical message will be generated\n";
|
print " -c (--crit) Minimum fill level at which a critical message will be generated\n";
|
||||||
print " (default 95)\n";
|
print " (default 95)\n";
|
||||||
print " -V (--version) Plugin version\n";
|
print " -V (--version) Plugin version\n";
|
||||||
print " -h (--help) usage help\n";
|
print " -h (--help) usage help\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user