From 1a5a83bb82c35d888229fe9f815fbc663c0f4d3c Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Fri, 21 Jan 2011 13:14:33 +0000 Subject: Fix for regex input of '|', being output causing problems with Nagios' parsing of performance data. Now replaced with ',' --- plugins/check_procs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'plugins/check_procs.c') diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 2151fb38..d875a618 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -318,6 +318,8 @@ process_arguments (int argc, char **argv) int err; int cflags = REG_NOSUB | REG_EXTENDED; char errbuf[MAX_INPUT_BUFFER]; + char *temp_string; + int i=0; static struct option longopts[] = { {"warning", required_argument, 0, 'w'}, {"critical", required_argument, 0, 'c'}, @@ -450,7 +452,14 @@ process_arguments (int argc, char **argv) regerror (err, &re_args, errbuf, MAX_INPUT_BUFFER); die (STATE_UNKNOWN, "PROCS %s: %s - %s\n", _("UNKNOWN"), _("Could not compile regular expression"), errbuf); } - asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), optarg); + /* Strip off any | within the regex optarg */ + temp_string = strdup(optarg); + while(temp_string[i]!='\0'){ + if(temp_string[i]=='|') + temp_string[i]=','; + i++; + } + asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), temp_string); options |= EREG_ARGS; break; case 'r': /* RSS */ -- cgit v1.2.3-74-g34f1