summaryrefslogtreecommitdiffstats
path: root/plugins/check_procs.c
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2003-04-11 23:47:39 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2003-04-11 23:47:39 (GMT)
commit12536a8506afce67a19248fd51462ebf2b80fd72 (patch)
tree512d847c14c68aaef5fd1162cf92c3fd5aabba8e /plugins/check_procs.c
parentb02afd9e09067cbd075f55c136948badaff12b46 (diff)
downloadmonitoring-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/check_procs.c')
-rw-r--r--plugins/check_procs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 3671559..737a87b 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -80,7 +80,7 @@ Optional Filters:\n\
80 -u, --user=USER\n\ 80 -u, --user=USER\n\
81 Only scan for processes with user name or ID indicated.\n\ 81 Only scan for processes with user name or ID indicated.\n\
82 -a, --argument-array=STRING\n\ 82 -a, --argument-array=STRING\n\
83 Only scan for ARGS that match up to the length of the given STRING.\n\ 83 Only scan for processes with args that contain STRING.\n\
84 -C, --command=COMMAND\n\ 84 -C, --command=COMMAND\n\
85 Only scan for exact matches to the named COMMAND.\n\ 85 Only scan for exact matches to the named COMMAND.\n\
86\n\ 86\n\
@@ -206,14 +206,13 @@ main (int argc, char **argv)
206 cols = 7; 206 cols = 7;
207 } 207 }
208 if ( cols >= 7 ) { 208 if ( cols >= 7 ) {
209 found++;
210 resultsum = 0; 209 resultsum = 0;
211 asprintf (&procargs, "%s", input_buffer + pos); 210 asprintf (&procargs, "%s", input_buffer + pos);
212 strip (procargs); 211 strip (procargs);
213 212
214 if ((options & STAT) && (strstr (statopts, procstat))) 213 if ((options & STAT) && (strstr (statopts, procstat)))
215 resultsum |= STAT; 214 resultsum |= STAT;
216 if ((options & ARGS) && procargs && (strstr (procargs, args) == procargs)) 215 if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL))
217 resultsum |= ARGS; 216 resultsum |= ARGS;
218 if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0)) 217 if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0))
219 resultsum |= PROG; 218 resultsum |= PROG;
@@ -233,6 +232,12 @@ main (int argc, char **argv)
233 procs, procuid, procvsz, procrss, 232 procs, procuid, procvsz, procrss,
234 procppid, procpcpu, procstat, procprog, procargs); 233 procppid, procpcpu, procstat, procprog, procargs);
235 234
235 /* Ignore self */
236 if (strcmp (procprog, progname) == 0)
237 continue;
238
239 found++;
240
236 /* Next line if filters not matched */ 241 /* Next line if filters not matched */
237 if (!(options == resultsum || options == ALL)) 242 if (!(options == resultsum || options == ALL))
238 continue; 243 continue;