I have tried setting up Nagios on Ubuntu 10.10, successfully installed and can login to web interface, I am however stuck on configuring snmp or I am doing something wrong here, i have followed various sites / nagios wiki to setup configuration (cfg) files.

When I check on the web interface, it gives the following error on one of my cisco router:

 Current Status:
  (for 0d 2h 55m 56s)
 Status Information:

SNMP problem - No data received from host CMD: /usr/bin/snmpget -t 1 -r 5 -m RFC1213-MIB -v 1 [authpriv]

On the command-line itself, when I type the following, it just sits there waiting and waiting :

sudo /usr/local/nagios/libexec/check_snmp -H -C Routers -o sysUpTime.0

When I type the following command : I get an OK

/usr/bin/snmpget -v1 -c "Routers"

I have configured SNMP properly on our cisco device as we can collect SNMP Data via two other monitoring tool (SolarWinds and Manage Engine), we are tempted towards Nagios as its opensource.

Will be grateful if someone could assist in rectifying this situation and guide me with setting up nagios to monitor Cisco Routers, Switches and a Few Servers.

We want to monitor Bandwidth, cpu utilization, uptime and other necessary counters.

  • Please post the check_snmp command definition? Did you take a look at the Nagios log? – quanta Nov 17 '11 at 0:29
  • Hi Quanta, I will get the requested information by tomorrow, also excuse me for sounding a complete dumbo - but where and how can I get the check_snmp definition ? This is my first time with Nagios.- Thanks – Shehryar Nov 17 '11 at 23:02

Add the version to the check_snmp command

  • Do i get the version from the nagios-plugins ? or if you could please tell me as to how can I check the version, that would be helpful.-Thanks – Shehryar Nov 17 '11 at 23:03
  • It's the version of SNMP in use on the equipment you are monitoring. You specific -v1 in your snmpget command. Run the check_snmp command without any flags to get the syntax. Mine uses -P to declare the SNMP version to use. It's an optional variable. I think the default would be 2c, so if your equipment only uses version 1 you would need to declare it when invoking check_snmp – dunxd Nov 18 '11 at 11:48

Maybe the MIBS for your Cisco Switches aren't loaded.

What happens if you do:

sudo /usr/local/nagios/libexec/check_snmp -H -C Routers -o

instead of sysUpTime.0?

If that works, then it is the MIBs - see net-snmp wiki for a tutorial on how to install and use MIBS. Otherwise check your syntax as pointed out by Mike Weber

  • Thanks dunxd, will post requested information tomorrow - thanks for your input, please keep an eye on this, I need to get this up and running, I want to learn and use Nagios :-) – Shehryar Nov 17 '11 at 23:03

Check the values that return by the probe, floating point numbers are not supported by expr, only integers. E.g.

$expr 0.9 / 10
expr: non-numeric argument

echo temp=$(expr $snmp / 10) # why echo?

temp=$(echo "$snmp / 10" | bc -l) # should do it

Use optional pipe through sed to give you .xx precision, e.g.

temp=$(echo "$snmp / 10" | bc -l| sed 's/\(\.[0-9]\{2\}\)\(.*\)/\1/')

Condition suffer from the same issue, unless you just truncate the results to the nearest integer you will need to do something like:

if [ $(echo "$temp < 28" | bc -l) -eq 1 ]; then :do your stuff here; fi

Also in nagios scripts try using full path to utilities to avoid issues with "path not found" during the execution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.