mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-23 21:55:16 +02:00
when arguments are missing or are not ok, return UNKNOWN
git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@11008 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
4713b399a5
commit
a7f14e45e9
@ -118,13 +118,13 @@ if ($opt_w && $opt_w =~ /^([0-9]+),([0-9]+),([0-9]+)$/) {
|
|||||||
@warning = ('1', '3', '5');
|
@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{'UNKNOWN'};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (my $i = 0; $i < scalar(@warning); $i++) {
|
for (my $i = 0; $i < scalar(@warning); $i++) {
|
||||||
if ($warning[$i] >= $critical[$i]) {
|
if ($warning[$i] >= $critical[$i]) {
|
||||||
print "Critical tresholds must be superior to warning tresholds.\n";
|
print "Critical tresholds must be superior to warning tresholds.\n";
|
||||||
exit $ERRORS{'OK'};
|
exit $ERRORS{'UNKNOWN'};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,10 +135,10 @@ if ($snmp eq "3") {
|
|||||||
}
|
}
|
||||||
if (!$opt_p && !$opt_k) {
|
if (!$opt_p && !$opt_k) {
|
||||||
print "Option -k (--key) or -p (--password) is required for snmpV3\n";
|
print "Option -k (--key) or -p (--password) is required for snmpV3\n";
|
||||||
exit $ERRORS{'OK'};
|
exit $ERRORS{'UNKNOWN'};
|
||||||
} elsif ($opt_p && $opt_k) {
|
} elsif ($opt_p && $opt_k) {
|
||||||
print "Only option -k (--key) or -p (--password) is needed for snmpV3\n";
|
print "Only option -k (--key) or -p (--password) is needed for snmpV3\n";
|
||||||
exit $ERRORS{'OK'};
|
exit $ERRORS{'UNKNOWN'};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user