Page 1 of 1
pnp4nagios graph name
Posted: Thu May 22, 2014 1:27 pm
by timchin
Hi, there. I create my own templates for pnp4nagios occasionally and I'm having trouble changing the 'Datastore:' name that appears above the graph. It always shows 'ds1', no matter what I do on custom templates.
In the past, I thought I could change it by using $ds_name[1] = "New name"; However, that's not doing the trick.
Does anyone have any ideas on what I might be doing wrong? Thanks!
Tim
Re: pnp4nagios graph name
Posted: Thu May 22, 2014 5:00 pm
by slansing
I have not personally tried this, but you may need to change the host/service's XML to define the new name as shown here:
http://docs.pnp4nagios.org/pnp-0.6/doc_complete
Re: pnp4nagios graph name
Posted: Thu May 22, 2014 5:36 pm
by timchin
Interesting. I viewed the xml in the perfdata directory and DS1 is named 'in' and DS2 is named 'out', which is correct. The template merges these two datasources to a single graph with 2 lines, but it's named 'ds1'. I can't find a reference to that anywhere, so this is strange to me. I though $ds_name[1] was the way to go, but it has no effect.
Tim
Re: pnp4nagios graph name
Posted: Thu May 22, 2014 6:37 pm
by Box293
I think you need to define it in opt[1]
Code: Select all
$opt[1] = "--vertical-label Load -l0 --title \"Blah Blah CPU Load for $hostname / $servicedesc\" ";
Selection_028.png
Re: pnp4nagios graph name
Posted: Thu May 22, 2014 11:13 pm
by timchin
That part works fine. Attached is a picture to better depict what I'm referring to. Thx!
Capture.PNG
Re: pnp4nagios graph name
Posted: Fri May 23, 2014 10:26 am
by tmcdonald
Take a look in /usr/local/nagiosxi/html/includes/lang/en-perfgraphs.inc.php
I think you can define what ds1, ds2 etc map to here. In
@Box293's example, "CPU Load" was mapped from "ds1" for the "check_local_load" command. Similarly, "Packet Loss" would map from "pl" for the default template, and "Response Time" can come from either "time" or "ds1" in the "check_http" command.
Make sense?
Re: pnp4nagios graph name
Posted: Fri May 23, 2014 11:45 am
by timchin
You're the man! That did the trick
Do you know if there's a way to remove the 'Datasource' completely from above the graph? I imagine it's not possible, so this is great!
Tim
Re: pnp4nagios graph name
Posted: Fri May 23, 2014 2:49 pm
by tmcdonald
/usr/local/nagiosxi/html/includes/components/xicore/dashlets-perfdata.inc.php
Search for "Datasource" and change both definitions.
Re: pnp4nagios graph name
Posted: Fri May 23, 2014 3:40 pm
by timchin
Great - Thx! I ended up not doing that, but it's nice to know that it's an option.
Tim
Re: pnp4nagios graph name
Posted: Fri May 23, 2014 5:15 pm
by Box293
Nice, I like learning new tricks
