Check multiple ports of a switch with snmp
Posted: Thu Mar 01, 2012 8:12 pm
Hi All,
I try to check our switch for bad packets. I have succesfully made the configuration file, but for some reason it always sais SNMP OK.
This is the command I use for checking:
/usr/local/nagios/libexec/check_snmp -H ip_address -C name -o ifInErrors.101 -w 10 -c 100, -o ifInErrors.102 -w 10 -c 100 -o ifInErrors.103 -w 10 -c 100, -o ifInErrors.104 -w 10 -c 100
And the result is:
SNMP OK - 0 20 0 0 | RFC1213-MIB::ifInErrors.101=0c RFC1213-MIB::ifInErrors.102=20c RFC1213-MIB::ifInErrors.103=0c RFC1213-MIB::ifInErrors.104=0c
As you can see I have bad backets on the second port of the switch (102), but for some reason the -w and -c part of the command only check the first number of the returned string. (In this case this is 0 so it thinks everything is ok)
If I put the bad port on the first place it reports warning:
/usr/local/nagios/libexec/check_snmp -H ip_address -C name -o ifInErrors.102 -w 10 -c 100, -o ifInErrors.101 -w 10 -c 100 -o ifInErrors.103 -w 10 -c 100, -o ifInErrors.104 -w 10 -c 100
SNMP WARNING - *20* 0 0 0 | RFC1213-MIB::ifInErrors.102=20c RFC1213-MIB::ifInErrors.101=0c RFC1213-MIB::ifInErrors.103=0c RFC1213-MIB::ifInErrors.104=0c
So is there a way to check the whole array of result and no only the first number of it?
I try to check our switch for bad packets. I have succesfully made the configuration file, but for some reason it always sais SNMP OK.
This is the command I use for checking:
/usr/local/nagios/libexec/check_snmp -H ip_address -C name -o ifInErrors.101 -w 10 -c 100, -o ifInErrors.102 -w 10 -c 100 -o ifInErrors.103 -w 10 -c 100, -o ifInErrors.104 -w 10 -c 100
And the result is:
SNMP OK - 0 20 0 0 | RFC1213-MIB::ifInErrors.101=0c RFC1213-MIB::ifInErrors.102=20c RFC1213-MIB::ifInErrors.103=0c RFC1213-MIB::ifInErrors.104=0c
As you can see I have bad backets on the second port of the switch (102), but for some reason the -w and -c part of the command only check the first number of the returned string. (In this case this is 0 so it thinks everything is ok)
If I put the bad port on the first place it reports warning:
/usr/local/nagios/libexec/check_snmp -H ip_address -C name -o ifInErrors.102 -w 10 -c 100, -o ifInErrors.101 -w 10 -c 100 -o ifInErrors.103 -w 10 -c 100, -o ifInErrors.104 -w 10 -c 100
SNMP WARNING - *20* 0 0 0 | RFC1213-MIB::ifInErrors.102=20c RFC1213-MIB::ifInErrors.101=0c RFC1213-MIB::ifInErrors.103=0c RFC1213-MIB::ifInErrors.104=0c
So is there a way to check the whole array of result and no only the first number of it?