I believe your if-else is flawed:
if ($score > $warnrate) { print "OK, rf is $score. \|Mbps=$score\n"; exit 0 # $score is necessarily <= $warnrate at this point #} elsif (($score <= $warnrate) && ($score > $critrate)) { } elsif ($score > $critrate) { print "WARNING, rf is $score. \|Mbps=$score\n"; exit 1 # $score is necessarily <= $critrate at this point #} elsif ($score <= $critrate) { } else { print "CRITICAL, rf is $score. \|Mbps=$score\n"; exit 2 # should never reach this point } else { print "UNKNOWN, rf is $score and something is wrong.\n"; exit 3 }
Also, your open DATA; while(<DATA>); close DATA seems odd. I haven't used snmpwalk before, and just tried without success; but I wonder if you can't just:
my $line = `/usr/bin/snmpwalk -v1 -c public $radio .1.3.6.1.4.1.5 +454.1.40.2.4.0`; my @values = split(' ', $line); my $score = $values[3]; if ...
In reply to Re: What did I miss in my test condition?
by hbm
in thread What did I miss in my test condition?
by jimbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |