correction for usage and warning and critical default value
git-svn-id: http://svn.centreon.com/trunk/plugins@3413 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
a9811a7e20
commit
bd2832ae43
|
@ -83,17 +83,19 @@ if (!$opt_H) {
|
||||||
my $snmp = "1";
|
my $snmp = "1";
|
||||||
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/);
|
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/);
|
||||||
|
|
||||||
@critical = ('2', '4', '6');
|
|
||||||
if ($opt_c && $opt_c =~ /^([0-9]+),([0-9]+),([0-9]+)$/) {
|
if ($opt_c && $opt_c =~ /^([0-9]+),([0-9]+),([0-9]+)$/) {
|
||||||
@critical = ($1,$2,$3);
|
@critical = ($1,$2,$3);
|
||||||
|
} elsif (!defined($opt_c) && !$opt_c){
|
||||||
|
@critical = ('2', '4', '6');
|
||||||
} else {
|
} else {
|
||||||
print "Specify three critical treshold separated with a coma\n";
|
print "Specify three critical treshold separated with a coma\n";
|
||||||
exit $ERRORS{'OK'};
|
exit $ERRORS{'OK'};
|
||||||
}
|
}
|
||||||
|
|
||||||
@warning = ('1', '3', '5');
|
|
||||||
if ($opt_w && $opt_w =~ /^([0-9]+),([0-9]+),([0-9]+)$/) {
|
if ($opt_w && $opt_w =~ /^([0-9]+),([0-9]+),([0-9]+)$/) {
|
||||||
@warning = ($1,$2,$3);
|
@warning = ($1,$2,$3);
|
||||||
|
} elsif (!defined($opt_w) && !$opt_w) {
|
||||||
|
@warning = ('1', '3', '5');
|
||||||
} else {
|
} else {
|
||||||
print "Specify three warning treshold separated with a coma\n";
|
print "Specify three warning treshold separated with a coma\n";
|
||||||
exit $ERRORS{'OK'};
|
exit $ERRORS{'OK'};
|
||||||
|
@ -167,13 +169,11 @@ my $quinze = $result->{$OID_CPULOAD_15};
|
||||||
|
|
||||||
# Plugin return code
|
# Plugin return code
|
||||||
my $status = "OK";
|
my $status = "OK";
|
||||||
if ($warning[0] <= $un || $warning[1] <= $cinq || $warning[2] <= $quinze) {
|
|
||||||
$status = "WARNING";
|
|
||||||
}
|
|
||||||
if ($critical[0] <= $un || $critical[1] <= $cinq || $critical[2] <= $quinze) {
|
|
||||||
$status = "CRITICAL";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$status = "WARNING" if ($warning[0] <= $un || $warning[1] <= $cinq || $warning[2] <= $quinze);
|
||||||
|
$status = "CRITICAL" if ($critical[0] <= $un || $critical[1] <= $cinq || $critical[2] <= $quinze);
|
||||||
|
|
||||||
|
# Print output
|
||||||
print "load average: ".$un.", ".$cinq.", ".$quinze.".|load1=".$un." load5=".$cinq." load15=".$quinze."\n";
|
print "load average: ".$un.", ".$cinq.", ".$quinze.".|load1=".$un." load5=".$cinq." load15=".$quinze."\n";
|
||||||
exit $ERRORS{$status};
|
exit $ERRORS{$status};
|
||||||
|
|
||||||
|
@ -181,8 +181,7 @@ sub print_usage () {
|
||||||
print "\nUsage:\n";
|
print "\nUsage:\n";
|
||||||
print "$PROGNAME\n";
|
print "$PROGNAME\n";
|
||||||
print " -H (--hostname) Hostname to query - (required)\n";
|
print " -H (--hostname) Hostname to query - (required)\n";
|
||||||
print " -C (--community) SNMP read community (defaults to public,\n";
|
print " -C (--community) SNMP read community (defaults to public)\n";
|
||||||
print " -C (--community) SNMP read community (defaults to public,\n";
|
|
||||||
print " -c (--critical) Three critical tresholds (defaults : 2,4,6)\n";
|
print " -c (--critical) Three critical tresholds (defaults : 2,4,6)\n";
|
||||||
print " -w (--warning) Three warning tresholds (defaults : 1,3,5)\n";
|
print " -w (--warning) Three warning tresholds (defaults : 1,3,5)\n";
|
||||||
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||||
|
|
Loading…
Reference in New Issue