Posts Tagged ‘nagios’

Nagios servicedependency

Wednesday, May 9th, 2012

I’ve got a series of nodes which have 3 SNMP-based checks configured on them. I wanted 2 of these checks to depend on 1, so that we only get a single alert if snmpd goes down or if the node drops offline. To do this, I created a servicedependency like so:

define servicedependency{
        host_name                       nodeX
        service_description             disk_usage
        dependent_service_description   load_avg_5m, swap_usage
        execution_failure_criteria      n
        notification_failure_criteria   u
}

As you can see, load_avg_5m and swap_usage depend on disk_usage.

With this configuration in place, I noticed that I was sometimes getting a notification for load_avg_5m, swap_usage and then disk_usage, since this was the order that these services were being checked. Unfortunately, I couldn’t find a way to configure the order in which the services were checked, but fortunately did find the following here:

“*One important thing to note is that by default, Nagios will use the most current hard state of the service(s) that is/are being depended upon when it does the dependeny checks. If you want Nagios to use the most current state of the services (regardless of whether its a soft or hard state), enable the soft_state_dependencies option.”

So, in my case, the current HARD state of disk_usage wasn’t UNKNOWN when the other checks failed, and therefore these services failed first and sent notifications. I’ve since set soft_state_dependencies=1 in /etc/nagios3/nagios.conf, and hope that this helps in reducing the amount of unnecessary notifications I get when there’s a node or snmpd outage.

nagios-nrpe-server

Friday, September 4th, 2009

I went to install nagios-nrpe-server on a Debian machine so I could use my Nagios server to do local service / resource monitoring on that machine but noticed apt-get tried to pull in a lot of dependencies for stuff that I don’t use:

xen1:~# apt-get install nagios-nrpe-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  fping libmysqlclient15off libperl5.10 libpq5 libradius1 libradiusclient-ng2 libsensors3 libsnmp-base libsnmp15 libtalloc1 libwbclient0 mysql-common
  nagios-plugins nagios-plugins-basic nagios-plugins-standard qstat radiusclient1 samba-common smbclient snmp
Suggested packages:
  lm-sensors nagios3 smbfs
The following NEW packages will be installed
  fping libmysqlclient15off libperl5.10 libpq5 libradius1 libradiusclient-ng2 libsensors3 libsnmp-base libsnmp15 libtalloc1 libwbclient0 mysql-common
  nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard qstat radiusclient1 samba-common smbclient snmp
0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.4MB of archives.
After this operation, 47.3MB of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
xen1:~#

A quick google revealed this link, and I was able to quickly adapt the syntax to apt-get:

xen1:~# apt-get --no-install-recommends install nagios-nrpe-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Recommended packages:
  nagios-plugins nagios-plugins-basic
The following NEW packages will be installed
  nagios-nrpe-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.8kB of archives.
After this operation, 168kB of additional disk space will be used.
Get: 1 http://debian.uchicago.edu lenny/main nagios-nrpe-server 2.12-1 [35.8kB]
Fetched 35.8kB in 0s (111kB/s)       
Selecting previously deselected package nagios-nrpe-server.
(Reading database ... 25376 files and directories currently installed.)
Unpacking nagios-nrpe-server (from .../nagios-nrpe-server_2.12-1_i386.deb) ...
Processing triggers for man-db ...
Setting up nagios-nrpe-server (2.12-1) ...
Starting nagios-nrpe: nagios-nrpe.
xen1:~#

I don’t know if this will cause problems down the line, but as it stands nrpe is working fine and doing what I need it to do.