Creating Static HTML from a CGI
Marc Powell
marc at ena.com
Mon Aug 2 18:31:25 CEST 2004
----Original Message----
From: Wheeler, MG [mailto:MG at ev3.net]
Sent: Monday, August 02, 2004 10:21 AM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Creating Static HTML from a CGI
> I want to use Cron to run one of the CGI reports and have it save to
> a static HTML page. It's our "Availability" report that I want as a
> static so people can see it without needing a password etc and since
> it's for the preceding week It doesn't need to be live.
Create the availability you want to be static in Nagios. Find the
complete url for the page (in I.E., right click on the availability
report frame and select properties); for a services availability report
using the default options it'll be something like:
http://your.nagios.host/cgi-bin/avail.cgi?show_log_entries=&service=all&
timeperiod=last7days&smon=8&sday=1&syear=2004&shour=0&smin=0&ssec=0&emon
=8&eday=2&eyear=2004&ehour=24&emin=0&esec=0&assumeinitialstates=yes&assu
mestateretention=yes&initialassumedstate=0&backtrack=4
Create a little script that uses wget to grab the page --
Mystaticreport.sh:
#/bin/sh
# Get the page with wget, saving it as a temp file
/usr/bin/wget --http-user nagiosloginuser --http-passwd
nagiosloginpassword -O /path/to/put/page/somereportname.tmp.$$ -q
"http://your.nagios.host/cgi-bin/avail.cgi?show_log_entries=&service=all
&timeperiod=last7days&smon=8&sday=1&syear=2004&shour=0&smin=0&ssec=0&emo
n=8&eday=2&eyear=2004&ehour=24&emin=0&esec=0&assumeinitialstates=yes&ass
umestateretention=yes&initialassumedstate=0&backtrack=4"
# Atomically move the file. You might want to put some error checking
here.
mv /path/to/put/page/somereportname.tmp.$$
/path/to/put/page/somereportname.html
exit(0)
That's it. Very basic, does no error checking. I've been doing this to
create the summary pages for about two years now with no noticable
problems.
--
Marc
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
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