Monitoring with SNMP

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Monitoring with SNMP

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Monitoring with SNMP

Post 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.
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.
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Monitoring with SNMP

Post by gavinr98 »

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

Post 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 ./
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Monitoring with SNMP

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring with SNMP

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Monitoring with SNMP

Post 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.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: Monitoring with SNMP

Post 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 :)
Locked