You are here

Graphing perfdata from custom checks

6 posts / 0 new
Last post
tobi
tobi's picture
Graphing perfdata from custom checks

Hi I am not sure if this has been addressed in another thread or not, but I wasn't able to find anything really helpful so far. I have written some custom scripts to do agent-less checks over ssh for our Linux servers and customized Matthieu Thibault's check_wmi for agent-less checks for our Windows servers. I am currently stuck with the RRD data. I have to admit that I am little overwhelmed with the information I have found so far on RRD and I am not too sure what applies to Opsview and what won't. For example my Linux check for memory usage does automatically create graphs but none of the other service checks do. Here are some example status information for these checks. Memory Usage, Usage: real 92% (466428/504564 MB), buffer: 1076 MB, cache: 9832 MB, swap: 4% (63492/1474556 MB) /boot Disk Usage, OK: 16.96% 0.04GB Used. 0.17GB availble. Check load, OK: CPU Load 2.10,1.87,1.43 (Current load) I will note as well, that I am open to modifying the output of the scripts to make them comply with a template already in Opsview. Actually I would prefer that if it is possible. I have checked /usr/local/nagios/var/rrd/server-name/ and I have only one folder for Memory%20Usage. So obviously if there is no RRD data, then flop has no data to graph. Are there any places where I could learn the basics of modifying the RRD templates and /usr/local/nagios/etc/map. I am trying to keep this server clean as it will be our first production server, but I need to have the graphing information for the higher ups to approve Opsview. Thanks in advance for the help

Anonymous's picture
Re: Graphing perfdata from custom checks

Essentially its very easy - read the guidelines at http://nagiosplug.sourceforge.net/developer-guidelines.html

If your plugin returns perfdata it will be graphed automatically - just do a reload after the first result is back and the graph icons will be shown in the UI

  Duncs

tobi
tobi's picture
Re: Graphing perfdata from custom checks

Thanks I found what I did wrong. I think I was making the perfdata part more complicated that it is. So to let people know I will post the example of the checks I had mentioned before.

Memory: "Usage: real %.0f%% (%.0f/%.0f MB), buffer: %.0f MB, cache: %.0f MB, swap: %.0f%% (%.0f/%.0f MB)|utilisation=%.0f\n", $real_used_pc, $real_used, $total_memory, $buffer_memory, $cache_memory, $swap_used_pc, $swap_used, $total_swap, $real_used_pc;

Load: "OK: CPU Load " . $min1 .",". $min5 .",".$min15 . " (Current load)| 'Load 1 min'=" . $min1 . ";" . $warn[0] . ";" . $crit[0] . ";0;10 'Load 5 min'=" . $min5 . ";" . $warn[1] . ";" . $crit[1] . ";0;10 'Load 15 min'=" . $min5 . ";" . $warn[2] . ";" . $crit[2] . ";0;10";

disk: "OK: " . sprintf("%.2f",$percent) . "% " . sprintf("%.2f",($used / 2097152)) . "GB Used. " . sprintf("%.2f",($avail / 2097152)) . "GB availble. | 'Usage'=" . sprintf("%.2f",$percent) . "%;".$warning.";".$critical."\n";

So for anyone else that might be having the same problem, after the " | " you need to make a definition, so for example 'Load 5 mins' = the variable that holds the data you want to graph. Then the warning metric so 4 for load and then critical metric so using I'm using 6 for load. The next two numbers are the minimum value that should be on the graph and the then the maximum value for the graph. Now all this can be whatever you want, you can put 'blahblahblah'=$time;0;0;0;2400, and that would be valid it just needs to be in the format described in more detail here. http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201 .

 

Hopefully this will help someone else with the same issue.

 

Thanks for the help Duncs

 

Tobi

Ramboy
Ramboy's picture
Re: Graphing perfdata from custom checks

Duncs, Tobi,

this post was really helpful, since I'm writing a customized temperature plug-in.

I'm wondering... I set the "warning" and "critical" values after the "|", in order to graph them. But I don't get any alert if the values go over these tresholds: is this syntax useful just for graph, or for alert too? Maybe I should write an exit 0, 1 or 2 inside the script, non enough the thresholds in perfdata?

 

Thank you so much.

Ram

Anonymous's picture
Re: Graphing perfdata from custom checks

> I set the "warning" and "critical" values after the "|", in order to graph them. But I don't get any alert if the values go over these tresholds: is this syntax useful just for graph, or for alert too?

The perfdata warning and critical alerts are only used in graphing, so if those limts are changed you can see in the graph when it was done in relation to any other figures returned.  The alerts are only generated when its a non-0 exit status on the script.

  Duncs

Ramboy
Ramboy's picture
Re: Graphing perfdata from custom checks

Ok. That's what I thought.

Thanks for confirming!

Cheers

Ram

Topic locked