X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fcheck_procs.c;h=ccf0891d13322c61a6710c7621a6a46673851eba;hb=6f53b99720ebe05d801f814fda823ef7c885f869;hp=3671559b1fcc03657ca5a844d70bb1b49747d403;hpb=7f2b0c8b5fda2d030f1e6534fc5d115eaf64b2b8;p=nagiosplug.git diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 3671559..ccf0891 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -80,7 +80,7 @@ Optional Filters:\n\ -u, --user=USER\n\ Only scan for processes with user name or ID indicated.\n\ -a, --argument-array=STRING\n\ - Only scan for ARGS that match up to the length of the given STRING.\n\ + Only scan for processes with args that contain STRING.\n\ -C, --command=COMMAND\n\ Only scan for exact matches to the named COMMAND.\n\ \n\ @@ -204,16 +204,19 @@ main (int argc, char **argv) /* Zombie processes do not give a procprog command */ if ( cols == 6 && strstr(procstat, zombie) ) { cols = 7; + /* Set some value for procargs for the strip command further below + Seen to be a problem on some Solaris 7 and 8 systems */ + input_buffer[pos] = '\n'; + input_buffer[pos+1] = 0x0; } if ( cols >= 7 ) { - found++; resultsum = 0; asprintf (&procargs, "%s", input_buffer + pos); - strip (procargs); + strip (procargs); if ((options & STAT) && (strstr (statopts, procstat))) resultsum |= STAT; - if ((options & ARGS) && procargs && (strstr (procargs, args) == procargs)) + if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL)) resultsum |= ARGS; if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0)) resultsum |= PROG; @@ -233,6 +236,12 @@ main (int argc, char **argv) procs, procuid, procvsz, procrss, procppid, procpcpu, procstat, procprog, procargs); + /* Ignore self */ + if (strcmp (procprog, progname) == 0) + continue; + + found++; + /* Next line if filters not matched */ if (!(options == resultsum || options == ALL)) continue;