Module: monitoring-plugin-perl
 Branch: master
 Commit: 94bb1dec4d9c8fec5e4aa51f9f8969be3a11528e
 Author: Paul Dugas <p...@dugasenterprises.com>
   Date: Thu Mar 31 16:32:12 2016 -0400
    URL: 
https://www.monitoring-plugins.org/repositories/monitoring-plugin-perl/commit/?id=94bb1de

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).

---

 lib/Monitoring/Plugin/Functions.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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;

Reply via email to