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

Find out how many services in nagios that have passive-check disabled, and email the output to

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

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

The script is written in Ruby and named as Nagcheck, you can download it here, or from the git repo at directly:

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

Share this post

Post Comment