--- process_perfdata.pl.orig 2006-11-01 11:00:53.000000000 +0100 +++ process_perfdata.pl 2006-11-01 11:03:08.000000000 +0100 @@ -145,21 +145,30 @@ } } +# strip leading blanks, because of performance data of check_snmp_storage +$NAGIOS_SERVICEPERFDATA=~s/^ *//; -my @t = split /=/,$NAGIOS_SERVICEPERFDATA; # Perfdata beim = splitten -my $t = shift @t; # Alles bis zum 1. = als $t -if ( $t =~ /^('.*)/ ) { - print_log ("Perfdata contains spaces ($NAGIOS_SERVICEPERFDATA) processing ...") if($log_level == 1); - @lines = split(/ '/, $NAGIOS_SERVICEPERFDATA); +my $search_pattern; +$search_pattern="(PREFIX=[0-9\.]+(B|kB|MB|GB|TB|PB|s|ms|us|ns|%|c|)"; +$search_pattern.="(;([0-9\.]+:?|~:[0-9\.]+|@?[0-9\.]+:[0-9\.]+)*){0,2}"; +$search_pattern.="(;([0-9\.]+)*){0,2};?) ?"; -}elsif ( $t =~ /(.*\s+.*)/ ) { - print_log ("Perfdata contains spaces ($NAGIOS_SERVICEPERFDATA) check illegal_macro_otput_chars in nagios.cfg") if($log_level == 1); - print_log ("PNP exiting ...") if($log_level == 1); - exit 1; -}else{ - print_log ("Perfdata is valid ($NAGIOS_SERVICEPERFDATA) ") if($log_level == 1); - @lines = split(/ /, $NAGIOS_SERVICEPERFDATA); +if ($NAGIOS_SERVICEPERFDATA=~/^'/) { + $search_pattern=~s/PREFIX/'[^']+'/; +} else { + $search_pattern=~s/PREFIX/[^= ]+/; +} + +while ($NAGIOS_SERVICEPERFDATA=~/$search_pattern/g) { + push (@lines, $1); +} + +if ($#lines==-1) { + print_log ("Perfdata not valid ($NAGIOS_SERVICEPERFDATA)") if ($log_level == 1); + exit 1; +} else { + print_log ("Perfdata is valid ($NAGIOS_SERVICEPERFDATA)") if ($log_level == 1); }