#56 Add performance data to check_procs plugin

closed
nobody
None
5
2012-11-14
2008-12-22
Jan Ondrej
No

check_procs plugin has no performance data. It can be nice to display performance data for number of processes or zombie processes.
I have my own perfdata wrapper until this will be a part of nagios-plugins, but my wrapper has very limited functionality.
You only need to display this at end of line from check_plugin:

|procs=NUMBER_OF_PROCS;WARN_PROC_COUNT;CRITICAL_PROC_COUNT;0

Attaching my wrapper, which does this, but it's not a right way. :)

Discussion

  • Jan Ondrej
    Jan Ondrej
    2008-12-22

     
    Attachments
  • GreenRover
    GreenRover
    2009-03-06

    Her as the original check_procs.c

    /root/nagios-plugins-1.4.13/plugins/check_procs.c
    row 308 befor " printf ("\n");"
    add:
    printf (" | ");
    printf (ngettext ("process=%d", "processes=%d", (unsigned long) procs), procs);
    printf (";%d;%d", wmax, cmax);

     
  • J.M. Roth
    J.M. Roth
    2011-01-27

    here's a diff to add performance data to check_procs.c

    --- check_procs-old.c 2010-07-27 22:47:16.000000000 +0200
    +++ check_procs.c 2011-01-27 10:02:08.000000000 +0100
    @@ -301,6 +301,7 @@
    if ( verbose >= 1 && strcmp(fails,"") )
    printf (" [%s]", fails);

    + printf ("|procs=%d;%d;%d;%d:%d;%d:%d", procs, warn, crit, wmin, wmax, cmin, cmax);
    printf ("\n");
    return result;
    }

     
  • J.M. Roth
    J.M. Roth
    2011-01-27

    Please forget my previous patch.

    I see there are several patches already listed: ID#
    2918676
    1106840
    1396989
    The oldest one is from 2005 :-\

    Additionally, here is my current one against 1.4.15

    --- check_procs-old.c 2010-07-27 22:47:16.000000000 +0200
    +++ check_procs.c 2011-01-27 13:34:19.000000000 +0100
    @@ -301,6 +301,35 @@
    if ( verbose >= 1 && strcmp(fails,"") )
    printf (" [%s]", fails);

    + printf ("|procs=%d", procs);
    + if (wmin == -1) {
    + if (wmax == -1) {
    + printf (";");
    + } else {
    + printf (";:%d", wmax);
    + }
    + } else {
    + if (wmax == -1) {
    + printf (";%d:", wmin);
    + } else {
    + printf (";%d:%d", wmin, wmax);
    + }
    + }
    + if (cmin == -1) {
    + if (cmax == -1) {
    + printf (";");
    + } else {
    + printf (";:%d", cmax);
    + }
    + } else {
    + if (cmax == -1) {
    + printf (";%d:", cmin);
    + } else {
    + printf (";%d:%d", cmin, cmax);
    + }
    + }
    + printf (";1");
    +
    printf ("\n");
    return result;
    }

     
  • Holger Weiß
    Holger Weiß
    2012-11-14

    In the next release, the check_procs plugin will provide performance data.

     
  • Holger Weiß
    Holger Weiß
    2012-11-14

    • status: open --> closed