Git Product home page Git Product logo

Comments (10)

sni avatar sni commented on September 24, 2024

does $plugin->plugin_exit(OK, "All good\nadditional\ndetails\nhere")work?

from monitoring-plugin-perl.

pdugas avatar pdugas commented on September 24, 2024

That's what I'm doing in the interim. However, when the $message is empty we call $plugin->plugin_exit(OK, "\nadditional\ndetails\nhere") and end up with output like so

OK -
additional
details
here|perfdata

The extra dash in the output is apparently annoying so some of my people. Maybe it'd be easier to just look for a leading \n in $message and skip the dash in that case.

from monitoring-plugin-perl.

pdugas avatar pdugas commented on September 24, 2024
--- Functions.pm.orig   2016-03-31 14:50:52.295849074 -0400
+++ Functions.pm    2016-03-31 14:55:17.350834574 -0400
@@ -118,7 +118,10 @@

     # Setup output
     my $output = "$STATUS_TEXT{$code}";
-    $output .= " - $message" if defined $message && $message ne '';
+    if (defined $message && $message ne '') {
+      $output .= " - " unless $message =~ /^ *\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;

from monitoring-plugin-perl.

sni avatar sni commented on September 24, 2024

Sounds ok for me, could you create a pull request? Then i could just merge it and you get proper credits.

from monitoring-plugin-perl.

sni avatar sni commented on September 24, 2024

and i would use /^\s*\n/;

from monitoring-plugin-perl.

pdugas avatar pdugas commented on September 24, 2024

I had \s initially but that matches the \n and the test would pass for " foo" as well as " \nfoo".

I guess I could use [ \f\r\t\w] which is what \s expands to minus the \n. Not terribly clean.

from monitoring-plugin-perl.

sni avatar sni commented on September 24, 2024

ah yes, you are right :-)

from monitoring-plugin-perl.

sni avatar sni commented on September 24, 2024

merged in #10

from monitoring-plugin-perl.

sni avatar sni commented on September 24, 2024

thanks

from monitoring-plugin-perl.

pdugas avatar pdugas commented on September 24, 2024

That regex isn't correct. My testing yesterday was minimal and
insufficient. I'm working on fixing it still but am having to dust off my
multiline matching foo. It needs a /m or /s. Will let you know if I can
fix it.

Paul Dugas, Computer Engineer
Dugas Enterprises, LLC http://www.dugasenterprises.com/
522 Black Canyon Park, Canton, GA 30114 USA
http://maps.google.com/?q=522%20Black%20Canyon%20Park,%20Canton,%20GA,%2030114%20,USA
o: 404-590-5159 | m: 404-932-1355 | e: [email protected]

On Thu, Mar 31, 2016 at 6:02 PM, Sven Nierlein [email protected]
wrote:

thanks


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

from monitoring-plugin-perl.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.