Daily status report?

Robert Arends rarends at imc.net.au
Wed Aug 16 01:02:16 CEST 2006


We needed an 8:30am daily email/pager message that gave a quick
synopsis.

So I wrote some perl to use a Nagios tool called "nagiostats" and email
the results nicely formatted.

nagiostats -m
--data=NUMHSTUP,NUMHSTDOWN,NUMHSTUNR,NUMSVCOK,NUMSVCCRIT,NUMSVCUNKN

<CODE>
#!/usr/bin/perl
use strict;
        my $options =
'NUMHSTUP,NUMHSTDOWN,NUMHSTUNR,NUMSVCOK,NUMSVCCRIT,NUMSVCUNKN';
        my $command = "nagiostats -m --data=$options";

        my @result = `$command`;
        chop(@result);

</CODE>

So now the results are in an array $result, put the following into a
print(), or an email routine, etc to send it to the suits.

<EXAMPLE Variables>
        HOSTS:
        Down:$result[1]
        UnReachable:$result[2]
        Up:$result[0]

        SERVICES:
        Critical:$result[4]
        UnReachable:$result[5]
        Up:$result[3]

</EXAMPLE Variables>

I run the program at 8:30 am every day.  For us it is used by the
monitoring staff, but you could use it for suits.

You could just use shell script and 'nagiostats' with out the -m, and
GREP out the lines you want and pipe in to mail.

Rob :-)

-----Original Message-----
From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of
rader at ginseng.hep.wisc.edu
Sent: Wednesday, 16 August 2006 7:08 AM
To: Josh Yost
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Daily status report?


 > From: Josh Yost
 > what kind of output are you wanting exactly?


This email and any attachments transmitted with it are confidential and may contain legally privileged information.  If you are not the intended recipient you are prohibited from disclosing, copying or using the information contained in it.  If you have received this email in error, please notify the sender immediately by return email and then delete all copies of this transmission together with any attachments.

It is the addressee's/recipient's duty to virus scan and otherwise test the email before loading it onto any computer system.  IMC Communications does not accept liability in connection with any computer virus, data corruption, delay, interruption, unauthorised access or unauthorised amendment in relation to this email.

For information about our privacy policy, visit the IMC Communications website at www.imc.net.au

This email has been checked by IMC's SMTP gateway.
-&-

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list