diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-04-11 23:47:39 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-04-11 23:47:39 +0000 |
commit | 12536a8506afce67a19248fd51462ebf2b80fd72 (patch) | |
tree | 512d847c14c68aaef5fd1162cf92c3fd5aabba8e /plugins | |
parent | b02afd9e09067cbd075f55c136948badaff12b46 (diff) | |
download | monitoring-plugins-12536a8506afce67a19248fd51462ebf2b80fd72.tar.gz |
Match -a STRING anywhere in ps args (Laurent Vaslin - 719783)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@488 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_procs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 3671559b..737a87b1 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\ @@ -206,14 +206,13 @@ main (int argc, char **argv) cols = 7; } if ( cols >= 7 ) { - found++; resultsum = 0; asprintf (&procargs, "%s", input_buffer + pos); 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 +232,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; |