NagiosStatus.pm » A Perl Module

NagiosStatus.pm » A Perl Module

» NagiosStatus.pm » Documentation

The following source code shows the general usage of the Perl Module. In this specific case, it would be a command line program, which prints to STDOUT the actual CRITICALs and WARNINGs of your Nagios environment.

#!/usr/bin/perl -w

use strict;
use warnings;

use NagiosStatus;

my $foo = NagiosStatus->new("/usr/local/nagios/var/status.dat");
#$foo->debug(1);
$foo->parse_statusfile();
$foo->evaluate();
my @alerts = $foo->get_alerts(["host_name", "service_description", "plugin_output"]);
foreach (@alerts)
{
	print "$_->{'type'}: $_->{'host_name'} - $_->{'service_description'} -";
	print " $_->{'plugin_output'}\n";
}

It's also very easy to create a website, which shows the actual state of the Nagios installation using the code above and wrapping around some HTML code. Using the META Tag for refreshing the page will keep the page actual and might be placed on a monitoring station or something else.

The code for this website is included in the tarball from the » download section « or even on » GitHub «.

 
 
 

NagiosStatus.pm

© 2010 - 2024 by Stefan Heumader-Rainer | Vienna (Austria) |

Data Privacy Statement