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
Monitoring with SNMP
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Monitoring with SNMP
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Monitoring with SNMP
Thanks, when I remove the ! I get the following error... chec_snmp: command not found?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitoring with SNMP
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
note the ./
Code: Select all
cd /usr/local/nagios/libexec
./check_snmp -C Public -o sysUpTime.0 -H 172.x.x.xRe: Monitoring with SNMP
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?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitoring with SNMP
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
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
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 ...

for example i have Ubuntu server and this is what i did ...
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 somethingcd /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