Skip to content

Commit 94bb1de

Browse files
committed
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).
1 parent 19ccd1d commit 94bb1de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Monitoring/Plugin/Functions.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ sub plugin_exit {
118118

119119
# Setup output
120120
my $output = "$STATUS_TEXT{$code}";
121-
$output .= " - $message" if defined $message && $message ne '';
121+
if (defined $message && $message ne '') {
122+
$output .= " - " unless $message =~ /^[ \f\r\t\w]*\n/;
123+
$output .= $message;
124+
}
122125
my $shortname = ($arg->{plugin} ? $arg->{plugin}->shortname : undef);
123126
$shortname ||= get_shortname(); # Should happen only if funnctions are called directly
124127
$output = "$shortname $output" if $shortname;

0 commit comments

Comments
 (0)