summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--plugins/check_procs.c11
-rw-r--r--plugins/tests/check_procs.t6
3 files changed, 16 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index aca6218..540e0cf 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ This file documents the major additions and syntax changes between releases.
11 check_disk_smb now handles NT_STATUS_ACCESS_DENIED properly (Debian #601696) 11 check_disk_smb now handles NT_STATUS_ACCESS_DENIED properly (Debian #601696)
12 Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds 12 Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds
13 Fix check_ldap overriding the port when --ssl was specified after -p 13 Fix check_ldap overriding the port when --ssl was specified after -p
14 Fix check_procs where regex input of '|' would get displayed in output - now replaced with ','
14 15
151.4.15 27th July 2010 161.4.15 27th July 2010
16 ENHANCEMENTS 17 ENHANCEMENTS
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 2151fb3..d875a61 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -318,6 +318,8 @@ process_arguments (int argc, char **argv)
318 int err; 318 int err;
319 int cflags = REG_NOSUB | REG_EXTENDED; 319 int cflags = REG_NOSUB | REG_EXTENDED;
320 char errbuf[MAX_INPUT_BUFFER]; 320 char errbuf[MAX_INPUT_BUFFER];
321 char *temp_string;
322 int i=0;
321 static struct option longopts[] = { 323 static struct option longopts[] = {
322 {"warning", required_argument, 0, 'w'}, 324 {"warning", required_argument, 0, 'w'},
323 {"critical", required_argument, 0, 'c'}, 325 {"critical", required_argument, 0, 'c'},
@@ -450,7 +452,14 @@ process_arguments (int argc, char **argv)
450 regerror (err, &re_args, errbuf, MAX_INPUT_BUFFER); 452 regerror (err, &re_args, errbuf, MAX_INPUT_BUFFER);
451 die (STATE_UNKNOWN, "PROCS %s: %s - %s\n", _("UNKNOWN"), _("Could not compile regular expression"), errbuf); 453 die (STATE_UNKNOWN, "PROCS %s: %s - %s\n", _("UNKNOWN"), _("Could not compile regular expression"), errbuf);
452 } 454 }
453 asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), optarg); 455 /* Strip off any | within the regex optarg */
456 temp_string = strdup(optarg);
457 while(temp_string[i]!='\0'){
458 if(temp_string[i]=='|')
459 temp_string[i]=',';
460 i++;
461 }
462 asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), temp_string);
454 options |= EREG_ARGS; 463 options |= EREG_ARGS;
455 break; 464 break;
456 case 'r': /* RSS */ 465 case 'r': /* RSS */
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t
index 1d0c034..d71c83a 100644
--- a/plugins/tests/check_procs.t
+++ b/plugins/tests/check_procs.t
@@ -8,7 +8,7 @@ use Test::More;
8use NPTest; 8use NPTest;
9 9
10if (-x "./check_procs") { 10if (-x "./check_procs") {
11 plan tests => 48; 11 plan tests => 50;
12} else { 12} else {
13 plan skip_all => "No check_procs compiled"; 13 plan skip_all => "No check_procs compiled";
14} 14}
@@ -113,3 +113,7 @@ $result = NPTest->testCmd( "$command --metric=RSS -c 70000 -v" );
113is( $result->return_code, 2, "Checking against RSS > 70MB" ); 113is( $result->return_code, 2, "Checking against RSS > 70MB" );
114is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowServer, SystemUIServer, Safari, Mail, Safari]', "Output correct" ); 114is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowServer, SystemUIServer, Safari, Mail, Safari]', "Output correct" );
115 115
116$result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" );
117is( $result->return_code, 0, "Checking no pipe symbol in output" );
118is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)'", "Output correct" );
119