[Nagiosplug-devel] performance data patch for check_ping.c

Thomas Guyot-Sionnest thomas at zango.com
Wed Apr 23 20:36:18 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christian Schneemann wrote:
| Ok, here a new try using fperdata():
| --- plugins/check_ping.c
| +++ plugins/check_ping.c
| @@ -165,7 +165,7 @@
|                                                         state_text
| (this_result), warn_text, pl, rta);
|                 if (display_html == TRUE)
|                         printf ("</A>");
| -               printf ("\n");
| +               printf("|%s\n", fperfdata ("rta", (double) rta, "ms",
FALSE,
| 0, FALSE, 0, FALSE, 0, FALSE, 0));
|
|                 if (verbose >= 2)
|                         printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta,
cpl);
|
|
| I have a question to the perfdata() and fperdata() functions.
| char *fperfdata (const char *label,
|  double val,
|  const char *uom,
|  int warnp,
|  double warn,
|  int critp,
|  double crit,
|  int minp,
|  double minv,
|  int maxp,
|  double maxv)
|
| Both have (almost) the same parameters, fperfdata for float values,
perfdata
| for integers, but how are the switches (warnp, critp, minp, maxp)
used? Must
| they be set if the next parameter should be activated? So has warnp be
TRUE
| if the check gives back a WARNING state?
| How could they be used adequate in this case?

Normally they are true if a warning/critical threshold is set. Just as
an example (it may not fit this particular case) let's say you have "int
warn=0, crit=0;" and you check thresholds only if they set so something
higher than 0, you could do:

fperfdata ("rta", (double) rta, "ms", warn>0?TRUE:FALSE, warn,
~  crit>0?TRUE:FALSE, crit, TRUE, 0, FALSE, 0);

NB: with rta, minp (minimum) is always 0 and there is no maxp (rta can
be as long as you allow the plugin to run).

| I had a look at some checks using perfdata() or fperfdata, and I think
I now
| have a check_ping, that can be used for performancedata. But I don't know
| what has to be set if the performance should be monitored more exactly.

It looks pretty close (and I can always close remaining gaps...) Looks
like your new patch doesn't report packet loss though.

| It is hard to use a function just from looking at how it is used from
others,
| a documentation is very helpful (yes, I have the best documentation, the
| sourcecode, but a written text can be easier to read ;)

This is something we'd like to address in the future by having a more
complete and generalized API, documented and installable for 3rd party
plugins. We have limited development resources in the team so this is
something that will take a while to implement.

Thanks for your time,

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFID4Gi6dZ+Kt5BchYRAuLSAJ9IaRg4JIgtpK7voo1nuYdBCVmJnACfdDLn
jbMpG2fAZssuuv5G4lcOzi8=
=8oAl
-----END PGP SIGNATURE-----




More information about the Devel mailing list