| Cheshire Cat Computing http://www.steveshipway.org/forum/ |
|
| using routers2.cgi to generate PNG graphs http://www.steveshipway.org/forum/viewtopic.php?f=2&t=1043 |
Page 1 of 2 |
| Author: | lee_connell [ Tue Jan 09, 2007 10:29 am ] |
| Post subject: | using routers2.cgi to generate PNG graphs |
I have routers 2.17 running fine on apache, and I have several sites I am monitoring, however I want to manually update the PNG files on disk without having to navigate to each site i have setup on the routers2.cgi site. I've been playing with routers2.cgi -A -D Firewalls/site.cfg -t d, it seems to generate some graphs but they don't have anything in them? the RRD files are all updated, how do I create a graph from the RRD files. I want to do this because I am building a script that emails these PNG files out to clients. Thanks! |
|
| Author: | stevesh [ Wed Jan 10, 2007 9:34 am ] |
| Post subject: | |
The -A flag will generate an archived graph (possibly what you want) in the graphs/<cfgfilename>/<targetname> directory. This is then retrievable from within routers2 on the corresponding Archive menu that appears for this target. However, if you use this, then you should also specify the -T option to give the target for which to create the graph. The -A option to the script is the same as clicking on the 'Archive' button from within routers2 (this only appears if you have archive=yes in the routers2.conf, see the documentation HOWTO for more details). An alternative way to do it is to run the script in image mode. For this, use '-I' instead of '-A'. This will output either an error message, or a .png file. routers2.pl -I -D cfgfile.cfg -T targetname > graph.png |
|
| Author: | lee_connell [ Thu Jan 11, 2007 2:46 am ] |
| Post subject: | |
I am using: /usr/lib/cgi-bin/routers2.cgi -I -D mvg.cfg -T Incoming > incoming.png I get this error: Interface: none Error: Not defined |
|
| Author: | lee_connell [ Thu Jan 11, 2007 3:01 am ] |
| Post subject: | |
I figured it out. I wasn't specifiying the -T or the -D parameter properly. I had to use Firewalls/mvg.cfg since I had it in a subdirectory and -I <ipoftarget> |
|
| Author: | stevesh [ Thu Jan 11, 2007 9:16 am ] |
| Post subject: | |
The -T and -D parameters correspond to the Target and Device -- to find out what to use, look for the if= and rtr= parameters in the URL when you click the 'Bookmark' button. If you use subdirectories, then these need to be included for the -D parameter (use the full path of the .cfg file, minus the confpath). The -T parameter is the MRTG targetname, IE, the 'ezwf' in the line 'Target[ezwf]: 1:community@device'. If your target is a userdefined graph, you will need to prepend '_' to the userdefined name. The special targets, such as the Incoming and Outgoing graphs, are '__incoming' and '__outgoing' (note the DOUBLE underscore). |
|
| Author: | DusterAZ [ Thu Mar 15, 2007 9:32 am ] |
| Post subject: | |
I'm having problems with this right now. This url works to display the image only on a web page: http://xxxxxxxx/cgi-bin/routers2.cgi?rt ... page=image But running this generates a blank file: ./routers2.cgi -I -D configs/ADA/Ada_DNS.cfg -T ADA_DNS > test.png Running v2.17 on FC4 |
|
| Author: | stevesh [ Thu Mar 15, 2007 11:27 am ] |
| Post subject: | |
This looks like a bug. It appears to work correctly the FIRST time, but subsequently this 'Interface: none' error appears. I'll try and get an update release out once this is fixed. |
|
| Author: | DusterAZ [ Thu Mar 15, 2007 2:15 pm ] |
| Post subject: | |
Thanks for the quick response Steve! I don't get an error at all however and just end up with an empty file. |
|
| Author: | stevesh [ Thu Mar 15, 2007 2:49 pm ] |
| Post subject: | |
Seems to work fine under 2.18beta2 althoughI get problems in 2.17a. Even though there should be no difference in this area. An empty file means that routers2 has found a problem and is unable to generate the image, but cannot output any more info! This should not happen... I can't see any way for it to occur unless the generated graph is empty due to an RRDTool error. Make sure you are running as the same user that the web service runs as, else there may be a permissions issue in creating the graph file (when run from the command line, it creates the file in the cache the same way that the web frontend does) I've tracked down my other problem, incidentally, to the fact that I also needed to add the -U option to specify authenticated user (the default user did not have visibility of the device in question). So, if you use authentication and per-user cfgfiles directives, you will need to use -U username to establish the rights. Note that this is only valid when called from the command line! |
|
| Author: | stevesh [ Thu Mar 15, 2007 2:58 pm ] |
| Post subject: | |
Checked the code. What can happen is that, if RRDTool is unable to create the graph image file, it returns *without* an error status but does not create the file. This means that routers2 will output a null file when used with -I. I have fixed this in v2.18 although I think it is a bug in RRRDTool (it should return an error status in this case!). So, it appears that, if you are getting an empty file, it means that your current user is (for some reason) unable to write to the graphs directory (where routers2 puts all generated graph images for caching. This applies to both cgi and command line mode. Check that you are running as the web server user or as root (and if as root, then make sure you dont leave files in the graphs dir owned by root!) |
|
| Page 1 of 2 | All times are UTC + 12 hours [ DST ] |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|