Greetings.....
I was able to use wget to access a report's webpage and download it to a
directory. I did have some trouble with versions of wget-- version 1.10.2
worked better for me than 1.11.1, couldn't get past the login screen in 1.11.1
In effect, I ended up re-writing the zenmail module as a shell script.
Interpolating between shell filenames and URLs was a major pain.
I'll try to get the short version in here.
--start script--
#!/usr/bin/sh
WEBSRV=/srv/www/htdocs
WEBDIR=zenoss-status
MYTEMP=/tmp
#The graph names will change every time we run the script
#...so we'd better clear out all the old graphs.
rm $WEBSRV/$WEBDIR/*.png
#retrieve the base web page with any auxiliary (css, etc.) files
#...but the actual GRAPHS we want will fail to be saved!
/path/to/your/wget --user=<YourZenUser> --password=<YourZenPwd> --no-proxy
-o$MYTEMP/zen-page-log.txt -nd -P$WEBSRV/$WEBDIR -NrEkp
http://<your.zenoss.host>:8080/zport/dmd/Reports/Multi-Graph%20Reports/<forExample>/Webserver%20Utilization/viewMultiGraphReportClean
#Parse the log file from WGET to pick out the graph URL's (url => JUNKNAME)
grep 'http://<your.zenoss.host>:8080/zport/RenderServer/render'
$MYTEMP/zen-page-log.txt | sed 's/^.*http/http/' |
while read JUNKNAME
do
#We will mangle the URL into a unique shorter name to be saved locally (local
file => NEWNAME)
NEWNAME=`echo $JUNKNAME | md5sum | cut -c-32 | sed
's/$/.png/'`
/path/to/yourl/wget --user=<YourZenUser>
--password=<YourZenPwd> --no-proxy -a$MYTEMP/zen-page-log.txt -nd
-P$WEBSRV/$WEBDIR -O$WEBSRV/$WEBDIR/$NEWNAME -Ekp $JUNKNAME
#Next we have to pick out the old graph URL from the WGET web page copy, so we
can replace it.
#...all the graphs start with src="render, so find that line and replace with
the new image file name.
LINENUM=`grep -n -o -m1 'src="render'
$WEBSRV/$WEBDIR/viewMultiGraphReportClean.html | cut -d: -f1`
sed "$LINENUM s...@src=\"render.* \/>@src=$NEWNAME \/>@"
$WEBSRV/$WEBDIR/viewMultiGraphReportClean.html >
$WEBSRV/$WEBDIR/viewMultiGraphReportClean.html.tmp
mv $WEBSRV/$WEBDIR/viewMultiGraphReportClean.html.tmp
$WEBSRV/$WEBDIR/viewMultiGraphReportClean.html
done
mv $WEBSRV/$WEBDIR/viewMultiGraphReportClean.html $WEBSRV/$WEBDIR/index.html
--end script--
(Sorry about how it looks, the copy into the forum killed the indentation.)
This worked for me, I run it in a cron job, and update the webpage every 5
minutes. I highly recommend reading thru all of the man pages for wget, it
took me a number of attempts to get this to work. But, browsing to the $WEBDIR
loads up the page with all the graphs (and the Zenoss logo) automatically.
--Jay
-------------------- m2f --------------------
Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=32342#32342
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users