[Nagiosplug-checkins] CVS: nagiosplug/plugins check_procs.c,1.14,1.15

Ton Voon tonvoon at users.sourceforge.net
Fri Apr 11 16:48:06 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv6483

Modified Files:
	check_procs.c 
Log Message:
Match -a STRING anywhere in ps args (Laurent Vaslin - 719783)


Index: check_procs.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_procs.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** check_procs.c	7 Apr 2003 23:40:33 -0000	1.14
--- check_procs.c	11 Apr 2003 23:47:39 -0000	1.15
***************
*** 81,85 ****
     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\
   -C, --command=COMMAND\n\
     Only scan for exact matches to the named COMMAND.\n\
--- 81,85 ----
     Only scan for processes with user name or ID indicated.\n\
   -a, --argument-array=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\
***************
*** 207,211 ****
  		}
  		if ( cols >= 7 ) {
- 			found++;
  			resultsum = 0;
  			asprintf (&procargs, "%s", input_buffer + pos);
--- 207,210 ----
***************
*** 214,218 ****
  			if ((options & STAT) && (strstr (statopts, procstat)))
  				resultsum |= STAT;
! 			if ((options & ARGS) && procargs && (strstr (procargs, args) == procargs))
  				resultsum |= ARGS;
  			if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0))
--- 213,217 ----
  			if ((options & STAT) && (strstr (statopts, procstat)))
  				resultsum |= STAT;
! 			if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL))
  				resultsum |= ARGS;
  			if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0))
***************
*** 233,236 ****
--- 232,241 ----
  					procs, procuid, procvsz, procrss,
  					procppid, procpcpu, procstat, procprog, procargs);
+ 
+ 			/* Ignore self */
+ 			if (strcmp (procprog, progname) == 0)
+ 				continue;
+ 
+ 			found++;
  
  			/* Next line if filters not matched */





More information about the Commits mailing list