You are here

How do I add a graph to a service?

8 posts / 0 new
Last post
nayax
nayax's picture
How do I add a graph to a service?

I've been looking all over the place for this...

Can anyone point me at the right direction?

 

Thanks

smarsh
smarsh's picture
Re: How do I add a graph to a service?

Graphs are automatically created based on the perfdata that the service check returns.

Hope this helps,

Sam

nayax
nayax's picture
Re: How do I add a graph to a service?

What do you mean?

Some of my services have the graph icon and some dont.

I have a very critical service that measures total bandwidth which doesnt.

Is there a way to force the graph on it?

smarsh
smarsh's picture
Re: How do I add a graph to a service?

It depends on the plugin - if the plugin doesnt return perfdata (have a google if your arent familiar with it), then you wont be able to graph. To find out if it is returning perfdata, just click on the service check and look at the box similar to the below:

http://imgur.com/Ayjkjxr

If there is nothing in the 'Performance Data' section, you wont be getting a graph. Its that simple im afraid. If your savvy enough, you can modify the plugin to return perfdata; basically add a "|" after the output return, and then add all things you want to graph on - after this.

Link here: http://nagios.sourceforge.net/docs/3_0/perfdata.html

nayax
nayax's picture
Re: How do I add a graph to a service?

I see now...

My script returns this as perdata:

traffic=.35; > 15 ; > 19 ;0; In=.16;;;0; Out=.19;

I suppose if this was more something like "traffic=0.35" then it would have worked.

Am I correct?

smarsh
smarsh's picture
Re: How do I add a graph to a service?

So heres an example:

$ /usr/local/nagios/libexec/check_nrpe -H hostnamehere -c check_memory -a '-w 90 -c 98' RETURN CODE: 0 (OK) OUTPUT: Usage: real 68% (5324/7871 MB), buffer: 379 MB, cache: 1665 MB, swap: 21% (840/3968 MB)|utilisation=68

This output means that i can graph on anything after the"|", which means i get a graph with a plot of 68 in this example. The code looks like:

printf "Usage: real %.0f%% (%.0f/%.0f MB), buffer: %.0f MB, cache: %.0f MB, swap: %.0f%% (%.0f/%.0f MB)|utilisation=%.0f\$ $real_used_pc, $real_used, $total_memory, $buffer_memory, $cache_memory, $swap_used_pc, $swap_used, $total_swap, $real_used_pc;As you can see, the "|utilisation=%.0f" bit - this is what we call 'perfdata'.
nayax
nayax's picture
Re: How do I add a graph to a service?

Appreciate the info!

That makes it much clearer now.

Thanks.

smarsh
smarsh's picture
Re: How do I add a graph to a service?

Your welcome!