Check Disk IO – Nagios

Quick steps to start checking disk i/o with nagios.

  1. wget  –no-check-certificate https://trac.id.ethz.ch/projects/nagios_plugins/downloads/check_diskio-3.2.3.tar.gz
  2. tar -xzvf check_diskio-3.2.3.tar.gz
  3. cd check_diskio-3.2.3
  4. vi check_diskio
    1. change line 1 to #!/usr/bin/perl, save and exit.
  5. apt-get install libnagios-plugin-perl libarray-unique-perl libfile-slurp-perl liblist-moreutils-perl libnumber-format-perl libreadonly-perl
  6. cp check_diskio /usr/local/icinga/libexec/check_diskio.pl
  7. vi /usr/local/icinga/etc/nrpe.cfg
    1. add the following line: command[check_diskio]=/usr/local/icinga/libexec/check_diskio.pl -d /dev/dm-0 -w 200 -c 300
    2. killall nrpe
    3. /usr/local/icinga/bin/nrpe -n -c /usr/local/icinga/etc/nrpe.cfg -d to restart nrpe daemon.
  8. modify config accordingly on the server and restart icinga.

Test:

./check_diskio -d / -w 200 -c 300

A wrapper for grabbing performance info from Nagios plugin

check_procs is an example for a plugin which doesn’t deliver performance data:

./check_procs -a apache2 -w 1: -c 0:
PROCS OK: 33 processes with args ‘apache2’

This can be changed with the following wrapper script:

#!/bin/bash
LINE=`/usr/local/nagios/libexec/check_procs $*`
RC=$?
COUNT=`echo $LINE | awk '{print $3}'`
echo $LINE \| procs=$COUNT
exit $RC

Now you’ll get the number together with the required label:

PROCS OK: 33 processes with args ‘apache2’| procs=33

SeleniumHQ Server on Nagios/Linux Host

These commands are tailored for a nagios installation.

Starting the selenium rc:

java -jar /usr/local/nagios/libexec/selenium/selenium-server.jar -firefoxProfileTemplate /usr/local/nagios/libexec/selenium/ff_selenium/

Sample nagios check command:

 

./check_selenium com.example.tests.someWebsiteCom http://some.website.com*firefox

Schedule:

Currently, login test is every hour.

nagios-check-webpage

This is a ruby script that can download a web page. Source here:

http://code.google.com/p/nagios-check-webpage/

Installation:

Prerequisites:

apt-get install ruby rubygems

gem update

apt-get install ruby1.8-dev

gem install hpricot

apt-get install libopenssl-ruby

 

Nagios Check Command:

define command{
        command_name    check-webpage
        command_line    $USER1$/check_webpage.rb -u $HOSTADDRESS$$ARG1$
        }