Page 1 of 1
Monitoring with SNMP
Posted: Fri Jan 25, 2013 1:51 pm
by gavinr98
Hello,
I am trying to monitor my switches with SNMP and when I run this command from the shell check_snmp!-C Public -o sysUpTime.0 -H 172.x.x.x I get the following error "-bash: !-C: event not found" ... any suggestions on how to fix this?
Thanks
Gavin
Re: Monitoring with SNMP
Posted: Fri Jan 25, 2013 3:03 pm
by sreinhardt
If you are running this from a bash type shell, you would want to be sure you are in /usr/local/nagios/libexec.(or wherever your libexec directory is if not standard) Then also remove the ! and replace with a [space]. The space\! issue is specifically what you are seeing with your error message.
Re: Monitoring with SNMP
Posted: Fri Jan 25, 2013 5:11 pm
by gavinr98
Thanks, when I remove the ! I get the following error... chec_snmp: command not found?
Re: Monitoring with SNMP
Posted: Sun Jan 27, 2013 12:38 am
by scottwilkerson
You cannot run check_snmp!-C Public -o sysUpTime.0 -H 172.x.x.x directly from the shell. to test this from the shell run
Code: Select all
cd /usr/local/nagios/libexec
./check_snmp -C Public -o sysUpTime.0 -H 172.x.x.x
note the ./
Re: Monitoring with SNMP
Posted: Wed Jan 30, 2013 3:51 pm
by gavinr98
when I run this command nothing happens, just get a blank line? however if I run this command I do get a response ./check_snmp-C Public -o ifOperStatus.1 -r 1 -m RFC1213-MIB -H 172.x.x.x ... just curious why one would work and the other one would not? I do get a SNMP ok when I monitor port 1 but get a (Service Check Timed Out) when monitoring the Uptime? any ideas?
Re: Monitoring with SNMP
Posted: Wed Jan 30, 2013 5:31 pm
by scottwilkerson
It is possible that this device either doesn't know or isn't set to respond to sysUpTime.0 in it's snmp configuration
Re: Monitoring with SNMP
Posted: Wed Jan 30, 2013 7:22 pm
by gavinr98
I used the OID .1.3.6.1.2.1.1.3.0 to query the service and it worked, not sure why sysUpTime.0 does not work but got it working this way.
Re: Monitoring with SNMP
Posted: Fri Feb 01, 2013 6:09 am
by MPIvan
You have to implement or download (what ever

) MIBs files. I have the same problem with my cisco router so i download the mibs files from the cisco site and now its work ok ...
for example i have Ubuntu server and this is what i did ...
cd /usr/share/mibs/netsnmp
wget ftp.cisco.com/pub/mibs/v2/SNMPv2-MIB.my
wget ftp.cisco.com/pub/mibs/v1/RFC1213-MIB.my
wget ftp.cisco.com/pub/mibs/v2/IANAifType-MIB.my
wget ftp.cisco.com/pub/mibs/v2/SNMPv2-TC.my
wget ftp.cisco.com/pub/mibs/v2/SNMPv2-SMI.my
echo "mibs +sysUpTime" >> /etc/snmp/snmp.conf
no sysUpTime is working great ... but you have to leave the .0 at the end ... for example if you monitor status of the interface ifOperStat.1 ..the number 1 indicate port 1 for sysUpTime.0 i dont know what is the 0 at the end but it do something
