in reply to What did I miss in my test condition?
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 ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What did I miss in my test condition?
by jimbass (Novice) on Aug 11, 2012 at 05:42 UTC | |
by hbm (Hermit) on Aug 13, 2012 at 00:53 UTC |