Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:
   UNKNOWN  
  (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] 192.168.1.1:161
ifOperStatus.1

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 192.168.1.1 -C Routers -o sysUpTime.0

When I type the following command : I get an OK

/usr/bin/snmpget -v1 192.168.1.1:161 1.3.6.1.2.1.1.5.0 -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.

share|improve this question
    
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 comment

3 Answers

Add the version to the check_snmp command

share|improve this answer
    
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
add comment

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

What happens if you do:

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

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

share|improve this answer
    
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
add comment

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.

SNMP-Oidview

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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