From 0e9e00cb324e0681bf1121954becb3fd245d910d Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Sat, 12 Apr 2003 00:02:15 +0000 Subject: Match -a STRING anywhere in ps args (Laurent Vaslin - 719783) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@489 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 755ed86..e26e0ff 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -129,13 +129,12 @@ main (int argc, char **argv) cols = 4; } if ( cols >= 4 ) { - 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; @@ -151,6 +150,10 @@ main (int argc, char **argv) printf ("%d %d %d %s %s %s\n", procs, procuid, procppid, procstat, procprog, procargs); #endif + if (strcmp (procprog, progname) == 0) + continue; + found++; + if (options == resultsum) procs++; } @@ -491,7 +494,7 @@ print_help (void) " -u, --user=USER\n" " Only scan for proceses 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" "RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n" -- cgit v0.10-9-g596f