Page 1 of 3

Manipulating trend charts

Posted: Tue Feb 07, 2012 11:57 am
by cwscribner
Hi all.

I'm not sure this is possible given Nagios' built-in defaults but I wanted to ask anyway. My client is looking to have the Nagios charts comparable to charts generated by Xymon. Xymon shows a 30 minute chart with 5 minute sampling that steadily rolls forward throughout the day.

So with that info, I guess my question is whether or not you can add/change the default chart views in Nagios?

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 1:51 pm
by scottwilkerson
cwscribner wrote:I'm not sure this is possible
It surely is possible ;)
cwscribner wrote: My client is looking to have the Nagios charts comparable to charts generated by Xymon. Xymon shows a 30 minute chart with 5 minute sampling that steadily rolls forward throughout the day.
I'm not exactly sure how you would want the chart laid out. I did a quick look at Xymon and it is using RRD so it certainly should be possible.
cwscribner wrote: So with that info, I guess my question is whether or not you can add/change the default chart views in Nagios?
The change would likely be made in:
/usr/local/nagiosxi/html/includes/components/perfdata/graphApi.php
or
/usr/local/nagiosxi/html/includes/components/perfdata/perfdata.inc.php

with possible modifications to:
/usr/local/nagios/share/pnp/templates.dist/response.php

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 2:53 pm
by cwscribner
I want to have the regular chart width and length, but instead of seeing a 4 hour spread of data, I just want 30 minutes. I'm looking to make it the default so the client doesn't have to repetitively query for that time frame.

I looked in the graphAPI but couldn't find anything explicit regarding default times. I saw a function at the very bottom defining time frames so I tried modifying that, but still no luck.

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 3:13 pm
by scottwilkerson
make a backup of graphApi.php just in case, and then try the following:

on about line 169, change

Code: Select all

$pnpviews = array('-4h', '-24h', '-7d', '-30d','-365d'); 
//timestamp conversions for PNP views 
$pnpstamps = array((60*60*4), (60*60*24), (60*60*24*7), (60*60*24*30), (60*60*24*365) ); 
to this

Code: Select all

$view=5;
$pnpviews = array('-4h', '-24h', '-7d', '-30d','-365d', '-30m'); 
//timestamp conversions for PNP views 
$pnpstamps = array((60*60*4), (60*60*24), (60*60*24*7), (60*60*24*30), (60*60*24*365), (60*30) ); 

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 3:40 pm
by cwscribner
That was the first thing I tried. I attempted it again just in case but the graphs still default to a 4h view.

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 3:51 pm
by scottwilkerson
Looking at this again, this was a bad idea...

$view=5;

made every graph a 30 minute graph on my test system...
cwscribner wrote:That was the first thing I tried. I attempted it again just in case but the graphs still default to a 4h view.
I guess I need to know which graphs you are looking at as well as what version of XI you are running, and if you have any special configuration.

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 4:06 pm
by cwscribner
I want to be able to set a graph (any and all graphs) to a 30 minute time frame, and add it to a dashboard and maintain that 30 minute time frame by auto-updating every so often. The update interval isn't important as long as its not more than 30m...obviously.

I'm on Xi 2011R1.9

I don't have any special configuration in terms of the interface. I have Nagvis installed if that matters. I haven't made any changes to RRD or any graphing mechanisms.

Re: Manipulating trend charts

Posted: Tue Feb 07, 2012 5:00 pm
by scottwilkerson
This is weird that they default to a 4h view, my clean install defaults to a 24h view.

If you use firefox, can you right click on a graph and choose "Copy Image Location" and post it here (obfuscate the domain if necessary)

Re: Manipulating trend charts

Posted: Wed Feb 08, 2012 4:40 pm
by cwscribner
So I have a problem...none of the charts are showing up...

Re: Manipulating trend charts

Posted: Wed Feb 08, 2012 4:46 pm
by scottwilkerson
If it is from mods to the perfdata component, you can upload this through Admin -> manage components to restore defaults.