Check services status in Nagios by Nagcheck

I just created a script Nagcheck to read services status in Nagios. It reads all the nagios settings, parse them, then create a report based on what you ask for.

With this script, you can do the following things:

  1. List the notification disabled (or enabled) hosts
  2. List the notification disabled (or enabled) services
  3. List the active check (or passive check) disabled (or enabled) services.
  4. The above output can be sent as mail if you enable its –mail-to parameter with an email address.

Here are two command-line examples:
Find out how many hosts in nagios that have notifications disabled.

$ ruby nagcheck.rb --statusfile /var/cache/nagios/status.dat --list-hosts --notify-disabled
Pub.Admon.org

Find out how many services in nagios that have passive-check disabled, and email the output to user@example.com.

$ ruby nagcheck.rb --statusfile /var/cache/nagios/status.dat --list-service --active-disabled --mail-to user@example.com

There is no output from this command. The filtered services are listed in the following format:

Pub.Admon.org:SSH_server
Blog.Admon.org:CPU_Stats

The script is written in Ruby and named as Nagcheck, you can download it here, or from the git repo at GitHub.com directly: git@github.com:admon/scripts.git

If you face any issues, please don’t hesitate to drop me a comment here, thanks!

Share Button

Leave a comment

Your email address will not be published. Required fields are marked *