summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Dugas <paul@dugasenterprises.com>2016-03-31 16:32:12 -0400
committerPaul Dugas <paul@dugasenterprises.com>2016-03-31 16:32:12 -0400
commit94bb1dec4d9c8fec5e4aa51f9f8969be3a11528e (patch)
tree5b1639eca0210ded0c5c168026db09e47cfb4e97
parent19ccd1dcb6a2ed0f13852118e988806792470782 (diff)
downloadmonitoring-plugin-perl-94bb1de.tar.gz
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).
-rw-r--r--lib/Monitoring/Plugin/Functions.pm5
1 files changed, 4 insertions, 1 deletions
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 {
118 118
119 # Setup output 119 # Setup output
120 my $output = "$STATUS_TEXT{$code}"; 120 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 }
122 my $shortname = ($arg->{plugin} ? $arg->{plugin}->shortname : undef); 125 my $shortname = ($arg->{plugin} ? $arg->{plugin}->shortname : undef);
123 $shortname ||= get_shortname(); # Should happen only if funnctions are called directly 126 $shortname ||= get_shortname(); # Should happen only if funnctions are called directly
124 $output = "$shortname $output" if $shortname; 127 $output = "$shortname $output" if $shortname;