Referenced by
Code

[RSS]
eyeWiki v1.0.0

Nagios Snmp Plugins


Nagios SNMP Plugins

What is it?

These are two plugins to be used with Nagios. They should still work with NetSaint, but as this is now really ancient, I don't support Netsaint any longer. You also need the Net SNMP Daemon in a reasonable new version.

Who wrote it?

These programs are (C) 2002-2008 by

Henning P. Schmiedehausen
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH
Hutweide 15
D-91054 Buckenhof

http://www.intermeta.de/

Distributed under GNU GENERAL PUBLIC LICENSE v2 (See file COPYING in the distribution).

Releases

VersionRelease dateCommentDownloadChecksumsSubversion URL
1.0March 29th, 2004first public release Download Sig MD5 SHA1 http://svn.softwareforge.de/svn/opensource/nagios-snmp-plugins/tags/release-1.0
1.1August 27th, 2007bug fix release Download Sig MD5 SHA1 http://svn.softwareforge.de/svn/opensource/nagios-snmp-plugins/tags/release-1.1
1.2January 27th, 2008feature release Download Sig MD5 SHA1 http://svn.softwareforge.de/svn/opensource/nagios-snmp-plugins/tags/release-1.2

Releases are signed with my Code signing key .

pub  1024D/754ED0AF 2005-08-26 Henning P. Schmiedehausen (CODE SIGNING KEY) <henning@softwareforge.de>
     Key fingerprint = 4E6F C658 CE88 9DB6 FC4E  FA97 16F5 C840 754E D0AF

Links

Where to get it?

The most current source is available from the Subversion repository:

svn checkout http://svn.softwareforge.de/svn/opensource/nagios-snmp-plugins/trunk/ nagios-snmp-plugins

Acknowlegdements & Thanks

  • Elan Ruusamäe <glen at pld-linux.org>
    • enhanced reporting for the check_snmp_proc plugin. Also the only patch I ever got from a distribution vendor. :-)
  • Jose Pedro Oliveira <jpo at di.uminho.pt>
    • for maintaining the Fedora Extras RPM; I rolled a number of things from that spec file back into the "official" one.
  • Oliver Faenger <oliver.faenger at cityweb.de>
    • representing many many people who reported and sent me patches for the gcc4 compilation issue.
  • Mark Janssen <maniac at maniac.nl>
    • patch that displays the checked devices and processes

All the Linux distributions who included that little hack into their package lists. BTW: I'd appreciate if you drop me a quick line when you include nagios-snmp-plugins into a distribution. So far I know of:

  • Fedora 7
  • Fedora Extras
  • PLD Linux

What can these plugins do?

NET-SNMP gives you an unique feature: It makes checks for running processes and/or disk size configurable in the SNMP daemon and queryable via SNMP. So you can do

proc  syslogd
proc  klogd

disk  /    5%
disk  /usr 10%

in your snmpd.local.conf and have the snmp daemon check that you always have free space on your root and usr file system and that you have syslogd and klogd processes running.

Querying this from a monitoring tool however, is very cumbersome. You need to check what disks are there, then query error status.

These two plugins do all the work for you.

Where do the plugins run?

Well, on Linux. :-) That's where I wrote them. They should compile on any other *x like Operating system, too. If you get them to compile, please let me know.

I compiled and tested these plugins on

  • RedHat Linux 9
  • Fedora Core 1,3-6
  • RedHat Enterprise Linux 3-5
  • CentOS 5

using various nagios versions between 1.2 and 2.9.

Users reported success on various SuSE Linux and SLES versions. Compilation on *BSD seems to be possible if you have a GNU getline library.

How do I build and install?

Unpack the distribution.

Run

aclocal
autoheader
automake --add-missing
autoconf
./configure
make

or simply

./build.sh

You should now have two binaries: check_snmp_disk and check_snmp_proc.

Copy them into your Nagios plugins directory.

How do I configure the plugins?

Using Nagios there are two ways to configure the plugins:

The old way: add the following two lines to your /etc/nagios/command.cfg:

command[check_snmp_disk]=/usr/lib/nagios/plugins/check_snmp_disk -H $HOSTADDRESS$ -C $ARG1$
command[check_snmp_proc]=/usr/lib/nagios/plugins/check_snmp_proc -H $HOSTADDRESS$ -C $ARG1$

Replace /usr/lib/nagios/plugins/ with the directory where you copied the binaries!

The new way: add the following lines to your /etc/nagios/checkcommands.cfg:

# 'check_snmp_disk' command definition
define command	{
	command_name	check_snmp_disk
	command_line	$USER1$/check_snmp_disk -H $ARG1$ -C $USER3$
}


# 'check_snmp_proc' command definition
define command	{
	command_name	check_snmp_proc
	command_line	$USER1$/check_snmp_proc -H $ARG1$ -C $USER3$
}

The Community password should be defined in your resources.cfg config file. If you don't use $USER3$, adjust the definition above.

How do I use the plugins?

First, select something to check. You find a detailed description in man snmpd.conf(5).

I, e.g. use (in /etc/snmpd/snmpd.local.conf under RedHat/Fedora):

#
# SNMP checked disks
#
disk	/		5%
disk	/usr		5%
disk	/var		10%
disk	/boot		1%
disk	/mnt/disk0	10%
#
# SNMP checked Processes
#
proc	crond
proc	ntpd
proc	sshd
proc	syslogd
proc	klogd

Which assures that my disks do not fill up and that I have the most important processes running on my boxes.

You need a configured snmpd with at least a read community configured.

Now try your configuration: Run the disk plugin manually:

check_snmp_disk -H host to check -C community

It should report either

Checked xxx disks. and a return code of 0 if everything is fine (xxx should be the number of disks configured in the snmp.local.conf file),

or

<diskname>: less than xxx% free (= yyy%) (devicename) and a return code of 2 if there is a problem (diskname and devicename depend on the disk, xxx is the threshold configured and yyy is the actual free space).

The same testing can be done with the check_snmp_proc plugin.

Now configure your monitor program to monitor a host (in hosts.cfg):

The old way:

service[myhost]=DISK;0;24x7;3;5;1;admins;120;24x7;1;1;0;;check_snmp_disk!''community''
service[myhost]=PROC;0;24x7;3;5;1;admins;120;24x7;1;1;0;;check_snmp_proc!''community''

where community is your read-community from above) and you are set. The ;0;24x7;3;5;1;admins;120;24x7;1;1;0;; parameters should be adjusted to match your configuration.

The new way:

# Service definition
define service	{
	use				generic-service

	host_name			myhost
	service_description		Disk Space
	check_command			check_snmp_disk!myhost
}

# Service definition
define service	{
	use				generic-service

	host_name			myhost
	service_description		Running processes
	check_command			check_snmp_proc!myhost
}

You should replace myhost with your host.

What is left to do?

  • Hard/Soft Thresholds
  • If multiple failures occur, only the first is reported (Nagios restriction) and every further error only when the first is fixed.

Release History

see NEWS

Copyright and License

This program is

Copyright (C) 2002-2008 by Henning Schmiedehausen

Distributed under GNU GENERAL PUBLIC LICENSE v2 (See COPYING in the distribution).



Go to top More info...
This page last changed on 27-Jan-2008 19:37:51 CET by HenningSchmiedehausen.