From: Sand P. <Phi...@sy...> - 2005-04-08 09:45:21
|
> > Hi all, > > > > I'm planning to generate some perfparse graphs and then automatically > send them to our > > customers. Has anyone done this before and could give me a hint, how to > automatically > > generate the graphs, and save them to disk? > > I know this "URL to create this graph:" thing, but how can I > automatically save this > > generated graph? >=20 > You can also save graphs. I have never used that feature and I don't know > if you can use > it for your need. >=20 > You have "URL to create this graph:" : use wget or curl to save that graph > into a file. > Then use the file... :) > About curl, if you plan to develop in C (or maybe other languages) your > tool to send > graphs to your customers, you can use libcurl. Thanks for your help! I wrote a little shell script, which you can simply add to your crontab. Needs a little handwork though, but is pretty simple to handle I think. ------------------------------------------------------------------------ - #!/bin/sh # Modify the Variables for your prupose # needs curl and uuencode installed SYSDATE=3D$(date +%Y%m%d) #Path to save the png Files LOGPATH=3D/usr/local/nagios/var #Filename for png Files, sysdate will add a simple timestamp after each file FILENAME1=3D$(echo OBDUDFS1_USERDISK_$SYSDATE.png) # Subject Line for mail SUBJECT1=3D$(echo "XXXXXXXXX -" $SYSDATE) #recipients (comma seperated for multiple reciepients) RECIPIENTS=3Dy...@yo...,yoursecondemail # optional, if your nagios needs http authentication USERNAME=3Dyouruser PASSWORD=3Dyourpassword # URL, which is postet by perfparse PERFPARSEURL=3Dhttps://yournagiosserver.xyz/nagios/cgi-bin/perfchart.png?= w hatsoever ##### nothing needs to be changed below ##### # get graph with curl curl -k -u $USERNAME:$PASSWORD -o $LOGPATH/$FILENAME1 "$PERFPARSEURL" #send the image uuencode $LOGPATH/$FILENAME1 $FILENAME1 | mail -s "$SUBJECT1" $RECIPIENTS ------------------------------------------------------------------------ ---- Hope this helps someone Philipp |