Re: [Nagios-users] Periodic and automated reporting

2006-12-18 Thread Ben O'Hara
On 12/18/06, Hari Sekhon <[EMAIL PROTECTED]> wrote:
> use nagios reporter from the exchange site
>
> http://www.nagiosexchange.org/AddOn_Projects.22.0.html?&tx_netnagext_pi1[p_view]=640
>


Heres a copy of the original ive modified slightly to include

1) output to HTML file
2) get availaibity reports
3) set which servicegroups to include

Cheers

Ben


#!/usr/local/bin/perl -w
#
# Nagios overnight/daily/weekly/monthly reporter
#
# Fetches Nagios report from web, processes HTML/CSS and emails to someone
# Written by Rob Moss, 2005-07-26, [EMAIL PROTECTED]
#
# Use at your own risk, knoweledge of perl required.
#
# Version 1.3.1
# - Overnight, Daily, Weekly, Monthly reports
#

use strict;
use Getopt::Long;
use Net::SMTP;
use LWP::UserAgent;
use Date::Manip;


my $mailhost=   'mx.trigold.net'; # Fill these in!
my $maildomain  =   'trigold.net';  #   Fill these in!
my $mailfrom=   '[EMAIL PROTECTED]'; #   Fill these in!
my $mailto = "";
my $timeout =   30;
my $mailsubject =   '';
my $mailbody=   '';
my $file =  "";
my $filedir =   "";
my $logfile =   '/apps/nagios/var/mail.log';#   Where
would you like your logfile to live?
my $debug   =   1;
#Set the debug level to 1 or higher for information

my $type=   '';
my $repdateprev;
my $reporturl;
my $availreport;
my $alertreport;
my $servicegroup= "all";
my $nagssbody;
my $nagsssummary;

my $webuser =   'nagios';
#Set this to a read-only nagios user (not nagiosadmin!)
my $webpass =   'password';
#Set this to a read-only nagios user (not nagiosadmin!)
my $webbase =
'http://monitor.office.trigold.net/nagios';#Set this to the base
of Nagios web page

my $webcssembed =   0;


GetOptions (
"debug=s"   =>  \$debug,
"help"  =>  \&help,
"type=s"=>  \$type,
"email=s"   =>  \$mailto,
"file=s"=>  \$filedir,
"embedcss"  =>  \$webcssembed,
"avail" =>  \$availreport,
"alerts"=>  \$alertreport,
"servicegroup=s"=>  \$servicegroup,
);


if (not defined $type or $type eq "") {
help();
exit;
}
elsif ($type eq "overnight") {
if ($availreport) {
report_overnight_avail();
}
elsif ($alertreport) {
report_overnight();
}
else { die("Unknown Availability or Alerts\n"); }
}
elsif ($type eq "daily") {
report_daily();
if ($availreport) {
report_daily_avail();
}
elsif ($alertreport) {
report_daily();
}
else { die("Unknown Availability or Alerts\n"); }
}
elsif ($type eq "weekly") {
if ($availreport) {
report_weekly_avail();
}
elsif ($alertreport) {
report_weekly();
}
else { die("Unknown Availability or Alerts\n"); }
}
elsif ($type eq "monthly") {
if ($availreport) {
report_monthly_avail();
}
elsif ($alertreport) {
report_monthly();
}
else { die("Unknown Availability or Alerts\n"); }
}
else {
die("Unknown report type $type\n");
}

debug(1,"reporturl: [$reporturl]");

$mailbody = http_request($reporturl);
if ($webcssembed) {
# Stupid hacks for dodgy notes
$nagssbody  =
http_request("$webbase/stylesheets/summary.css");
$nagsssummary = "\n";
foreach ( split(/\n/,$nagssbody) ) {
chomp;
if (not defined $_ or $_ eq "" ) {
next;
}
$nagsssummary .= "\n";
}
$nagsssummary .= "\n";
$nagsssummary .= "\n";

$mailbody =~ s@@@;
$mailbody =~ s@@$nagsssummary@;
}

if ($file) {
open(FILE, "> $file") or warn "can't open file
/tmp/nagios-report-htmlout.html: $!\n";
print FILE $mailbody;
close FILE;
} elsif ($mailto) {
sendmail();
} else {
die("No File or Email Specified\n");
}


###
sub help {
print <<_END_;

Nagios web->email reporter program.

$0 

--help
This screen

--email=
Send to this address instead of the default address
"$mailto"

--file=
Directory to write Reports to in eg /usr/local/nagios/share/reports
./avail/--.html
--type=overnight
Overnight report, from 17h last working day to Today (9am)
--type=daily
Daily report, 09:00 last working day to Today (9am)
--type=weekly
Weekly report, 9am 7 days ago, until 9am today (run at 9am friday!)
--type=monthly
Monthly report, 1st of prev month at 9am to last day of month, 9am

--avail Availabilty Reports
--alerts Al

Re: [Nagios-users] Periodic and automated reporting

2006-12-18 Thread Hari Sekhon
use nagios reporter from the exchange site

http://www.nagiosexchange.org/AddOn_Projects.22.0.html?&tx_netnagext_pi1[p_view]=640

-h

Hari Sekhon



Horvath Tamas wrote:
> Hi listmembers!
>
> Our customer would like an automatic reporting mechanism with Nagios (for
> example it could run first days of every month for the last month).
>
> I can see how can I invoke for example the Availability Reporting CGI, but I
> think I can invoke it only from a browser. So I can't automatize it.
>
> Does anybody have such an experience, or some idea how can I do this?
>
> Thanks in advance, Tamas
>
>
>
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___
> Nagios-users mailing list
> Nagios-users@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
>
>   

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] Periodic and automated reporting

2006-12-14 Thread Horvath Tamas

Hi listmembers!

Thanks all of you, who replied to me.

I'm going to investigate all of the suggested solutions.

Merry Christmas ll of you!

Tamas!


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] Periodic and automated reporting

2006-12-14 Thread rader

 > From: "Horvath Tamas"
 > Hi listmembers!
 > 
 > Our customer would like an automatic reporting mechanism with Nagios (for
 > example it could run first days of every month for the last month).
 > 
 > I can see how can I invoke for example the Availability Reporting CGI, but
 >  I
 > think I can invoke it only from a browser. So I can't automatize it.
 > 
 > Does anybody have such an experience, or some idea how can I do this?

 http://noc.hep.wisc.edu/nagiosr.txt
 http://www.hep.wisc.edu/~rader/nagiosr.html
 ftp://noc.hep.wisc.edu/pub/src/nagiosr/ 

?

steve 
- - - 
systems & network manager
high energy physics
university of wisconsin

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] Periodic and automated reporting

2006-12-14 Thread Lars Stavholm
Horvath Tamas wrote:
> Hi listmembers!
> 
> Our customer would like an automatic reporting mechanism with Nagios (for
> example it could run first days of every month for the last month).
> 
> I can see how can I invoke for example the Availability Reporting CGI, but I
> think I can invoke it only from a browser. So I can't automatize it.
> 
> Does anybody have such an experience, or some idea how can I do this?

 via cron job.
/L

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] Periodic and automated reporting

2006-12-14 Thread Peter Hinse
Horvath Tamas wrote:
> Hi listmembers!
> 
> Our customer would like an automatic reporting mechanism with Nagios
> (for example it could run first days of every month for the last
> month).
> 
> I can see how can I invoke for example the Availability Reporting
> CGI, but I think I can invoke it only from a browser. So I can't
> automatize it.

"Nagios Email Reporter" might be interesting for you:

> This perl script can request an overnight, daily, weekly or monthly
> report from the Nagios server using the standard CGIs, it then parses
> the output (formats CSS for Web and Lotus Notes), then emails as an
> Inline HTML email to a supplied email address.

http://www.nagiosexchange.org/AddOn_Projects.22.0.html?&tx_netnagext_pi1[p_view]=640

Regards,

Peter

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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


[Nagios-users] Periodic and automated reporting

2006-12-13 Thread Horvath Tamas
Hi listmembers!

Our customer would like an automatic reporting mechanism with Nagios (for
example it could run first days of every month for the last month).

I can see how can I invoke for example the Availability Reporting CGI, but I
think I can invoke it only from a browser. So I can't automatize it.

Does anybody have such an experience, or some idea how can I do this?

Thanks in advance, Tamas




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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