summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2003-04-12 00:02:15 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2003-04-12 00:02:15 (GMT)
commit0e9e00cb324e0681bf1121954becb3fd245d910d (patch)
treecc05af061562ec6c57bbbe1c3bc6a698cfb22d65 /plugins
parentb096b73409fe63392c585426e9e641ee6c63612a (diff)
downloadmonitoring-plugins-0e9e00cb324e0681bf1121954becb3fd245d910d.tar.gz
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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_procs.c9
1 files changed, 6 insertions, 3 deletions
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)
129 cols = 4; 129 cols = 4;
130 } 130 }
131 if ( cols >= 4 ) { 131 if ( cols >= 4 ) {
132 found++;
133 resultsum = 0; 132 resultsum = 0;
134 asprintf (&procargs, "%s", input_buffer + pos); 133 asprintf (&procargs, "%s", input_buffer + pos);
135 strip (procargs); 134 strip (procargs);
136 if ((options & STAT) && (strstr (statopts, procstat))) 135 if ((options & STAT) && (strstr (statopts, procstat)))
137 resultsum |= STAT; 136 resultsum |= STAT;
138 if ((options & ARGS) && procargs && (strstr (procargs, args) == procargs)) 137 if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL))
139 resultsum |= ARGS; 138 resultsum |= ARGS;
140 if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0)) 139 if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0))
141 resultsum |= PROG; 140 resultsum |= PROG;
@@ -151,6 +150,10 @@ main (int argc, char **argv)
151 printf ("%d %d %d %s %s %s\n", procs, procuid, procppid, procstat, 150 printf ("%d %d %d %s %s %s\n", procs, procuid, procppid, procstat,
152 procprog, procargs); 151 procprog, procargs);
153#endif 152#endif
153 if (strcmp (procprog, progname) == 0)
154 continue;
155 found++;
156
154 if (options == resultsum) 157 if (options == resultsum)
155 procs++; 158 procs++;
156 } 159 }
@@ -491,7 +494,7 @@ print_help (void)
491 " -u, --user=USER\n" 494 " -u, --user=USER\n"
492 " Only scan for proceses with user name or ID indicated.\n" 495 " Only scan for proceses with user name or ID indicated.\n"
493 " -a, --argument-array=STRING\n" 496 " -a, --argument-array=STRING\n"
494 " Only scan for ARGS that match up to the length of the given STRING\n" 497 " Only scan for processes with args that contain STRING.\n"
495 " -C, --command=COMMAND\n" 498 " -C, --command=COMMAND\n"
496 " Only scan for exact matches to the named COMMAND.\n\n" 499 " Only scan for exact matches to the named COMMAND.\n\n"
497 "RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n" 500 "RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n"