Fwd:

Brian Loe knobdy at gmail.com
Mon Nov 20 20:23:03 CET 2006


So, in the script that follows, should both (for example) smon and
emon be "=0" or "=$mon"? I'm running a hostgroup availability,
timeperiod=lastweek...


#!/usr/bin/perl
$now=time;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon++;
$year += 1900;
$threeago = ($mon + 9) % 12;
if ($threeago > $mon) { $year-- }

$wget = '/usr/bin/wget --http-user=guest --http-passwd=guest -O ';
$sed = '/bin/sed -e \'s/avail.cgi/nagios\/cgi-bin\/avail.cgi/\'';

$url =
"http://localhost/nagios/cgi-bin/avail.cgi\?show_log_entries=\&host=all\&timeperiod=custom\&smon=$threeago\&sday=1\&syear=$year\&shour=1\&smin=0\&ssec=0\&emon=$mon\&eday=1\&eyear=$year\&ehour=0\&emin=0\&esec=0\&rpttimeperiod=\&assumeinitialstates=yes\&assumestateretention=yes\&assumestatesduringnotrunning=yes\&includesoftstates=no\&initialassumedhoststate=3\&initialassumedservicestate=6\&backtrack=2";

$out = '/var/www/html/hostavail.html';
`$wget /tmp/foo \"$url\"`;
`$sed </tmp/foo >$out`;

$url =
"http://localhost/nagios/cgi-bin/avail.cgi\?show_log_entries=\&host=10.10.0-defrouter\&service=all\&timeperiod=custom\&smon=$threeago\&sday=1\&syear=$year\&shour=1\&smin=0\&ssec=0\&emon=$mon\&eday=1\&eyear=$year\&ehour=0\&emin=0\&esec=0\&rpttimeperiod=\&assumeinitialstates=yes\&assumestateretention=yes\&assumestatesduringnotrunning=yes\&includesoftstates=no\&initialassumedservicestate=6\&backtrack=2";

$out = '/var/www/html/svcavail.html';
`$wget /tmp/foo \"$url\"`;
`$sed </tmp/foo >$out`;

-------------------------------------------------------------------------
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 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