From 94bb1dec4d9c8fec5e4aa51f9f8969be3a11528e Mon Sep 17 00:00:00 2001 From: Paul Dugas Date: Thu, 31 Mar 2016 16:32:12 -0400 Subject: Support LONGTEXT output Pass `TEXT OUTPUT\nLONGTEXT1\nLONGTEXT2` to as the second parameter to `plugin_exit()` to add LONGOUTPUT lines. If the parameter is has a leading newline (i.e. `\nLONGTEXT1\nLONGTEXT2`), skip emitting the hyphen (dash). diff --git a/lib/Monitoring/Plugin/Functions.pm b/lib/Monitoring/Plugin/Functions.pm index 62bb14b..a19db49 100644 --- a/lib/Monitoring/Plugin/Functions.pm +++ b/lib/Monitoring/Plugin/Functions.pm @@ -118,7 +118,10 @@ sub plugin_exit { # Setup output my $output = "$STATUS_TEXT{$code}"; - $output .= " - $message" if defined $message && $message ne ''; + if (defined $message && $message ne '') { + $output .= " - " unless $message =~ /^[ \f\r\t\w]*\n/; + $output .= $message; + } my $shortname = ($arg->{plugin} ? $arg->{plugin}->shortname : undef); $shortname ||= get_shortname(); # Should happen only if funnctions are called directly $output = "$shortname $output" if $shortname; -- cgit v0.10-9-g596f