diff options
| author | Paul Dugas <paul@dugasenterprises.com> | 2016-03-31 16:32:12 -0400 | 
|---|---|---|
| committer | Paul Dugas <paul@dugasenterprises.com> | 2016-03-31 16:32:12 -0400 | 
| commit | 94bb1dec4d9c8fec5e4aa51f9f8969be3a11528e (patch) | |
| tree | 5b1639eca0210ded0c5c168026db09e47cfb4e97 /lib/Monitoring/Plugin/Functions.pm | |
| parent | 19ccd1dcb6a2ed0f13852118e988806792470782 (diff) | |
| download | monitoring-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).
Diffstat (limited to 'lib/Monitoring/Plugin/Functions.pm')
| -rw-r--r-- | lib/Monitoring/Plugin/Functions.pm | 5 | 
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; | 
