Flatten error messages for Nagios one-line 'unknown' output.
authorGreg Sabino Mullane <greg@endpoint.com>
Sun, 28 Sep 2008 21:10:16 +0000 (17:10 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Sun, 28 Sep 2008 21:10:16 +0000 (17:10 -0400)
Avoid pipes in unknown messages if showperf is true.

check_postgres.pl

index 9599eeb4985930746b35d2582d0d3a7e27fb2cfb..96670ab934b6eedc58bbb6ac43dc3bfd7e8f5d27 100755 (executable)
@@ -351,6 +351,8 @@ sub add_response {
 
 sub add_unknown {
        my $msg = shift || $db->{error};
+       $msg =~ s/[\r\n]\s*/\\n /g;
+       $msg =~ s/\|/<PIPE>/g if $opt{showperf};
        add_response \%unknown, $msg;
 }
 sub add_critical {