On 5/10/11 9:46 AM, khurram aziz wrote:
Hi,

i am using Nagios 3.2.3 & want to enable SNMP Trap Handling so that I can check uptime of my servers ( snmp service has already been enabled on the servers).

can sum1 help me with the configuration.
Well, first off you don't need snmp traps to check uptime.

$ /usr/local/nagios/libexec/check_snmp -H localhost -o .1.3.6.1.2.1.1.3.0 -C xxxxxx
SNMP OK - Timeticks: (362041566) 41 days, 21:40:15.66 |
$

If all you want to see is an uptime counter, add a service that does that. Replace localhost with $HOSTADDRESS$, and replace xxxxxx with your snmp community. Unfortunately, check_snmp doesn't seem to support having warning or critical thresholds, so unless snmpd is down, that will always return ok. You can use snmpget to get the raw timeticks:

$ snmpget -Ovt -v2c -c xxxxx localhost .1.3.6.1.2.1.1.3.0
36207797
$

If you want a critical alert every time a box has rebooted, write a shell script that calls that snmpget command, passing in the host address and snmp community via the command line. Of course, that will throw an Unknown while the box is actually down (snmp can't tell if the host is down, or if you've passed the wrong snmp community.)

If what you really want is to know when your box is down, use check_ssh:
$ /usr/local/nagios/libexec/check_ssh localhost
SSH OK - OpenSSH_5.1p1 FreeBSD-20080901 (protocol 2.0)
$

That will throw a critical any time it can't connect, or if it can connect but the ssh version string isn't found.

If you still want to use snmp traps, here's a link to some lovely documentation:

http://snmptt.sourceforge.net/docs/snmptt.shtml

There's even a section on integrating with Nagios, though I suggest you get some coffee and a snack and read the whole page.

--
Mike Lindsey

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to