Git Product home page Git Product logo

monitoring-plugin-perl's Issues

Add LONGOUTPUT parameter to plugin_exit

I'd like to be able to use something like the code below to emit additional lines of LONGOUTPUT from a plugin.

$plugin->plugin_exit(OK, "All good", "additional\ndetails\nhere")

The output from this would be something like

OK - All good
additional
details
here|perfdata...

Can't locate Monitoring/Plugin.pm

Problem: when rinning 'bin/check_raid.pl -S' I get this error

Can't locate Monitoring/Plugin.pm in @INC (you may need to install the Monitoring::Plugin module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at bin/check_raid.pl line 2.
BEGIN failed--compilation aborted at bin/check_raid.pl line 2.

Environment: debian 8.2 x86_64 and debian 7.8 x86_64.

Steps:
downloaded the plugin in /tmp and extracted the tar.gz.
cd nagios-plugin-check_raid-master

Following the readme I run bin/check_raid.pl -S but I get the errore above.
I also tried to install libnagios-object-perl and libnagios-plugin-perl as suggested in this post
http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=25251

In this other post they point out the issue about a path:
https://viewsby.wordpress.com/2014/02/20/perlnagios-cant-locate-utils-pm-in-inc/

I hope I'm not missing something trivial.

Cosmetic: First "perl Makefile.PL" complains about META.yml

The first time you run "perl Makefile.PL" after cloning, the script complains about META.yml... and then proceeds to write it out. This is cosmetic in nature, though may "panic" the unwary.

$ perl Makefile.PL 
include /home/my_home_dir/github/monitoring-plugin-perl/inc/Module/Install.pm
include inc/Module/Install/Metadata.pm
include inc/Module/Install/Base.pm
include inc/Module/Install/Makefile.pm
include inc/Module/Install/WriteAll.pm
include inc/Module/Install/Win32.pm
include inc/Module/Install/Can.pm
include inc/Module/Install/Fetch.pm
Checking if your kit is complete...
Warning: the following files are missing in your kit:
	META.yml
Please inform the author.
Writing Makefile for Monitoring::Plugin
Writing MYMETA.yml and MYMETA.json
Writing META.yml

[doc] missing documentation

http://search.cpan.org/~nierlein/Monitoring-Plugin-0.39/lib/Monitoring/Plugin.pm#CONSTRUCTOR

there's no documentation for version, blurb, license, extra, plugin, timeout parameters

as for example i was looking where to put information about homepage and where to report bugs and copyright years and author.


for homepage and bugs url, i just appended to blurb:
glensc/nagios-plugin-check_raid@cd17820

for license and copyright did not find good solution: i do not want to replace license key, i like that default GPLv2 is printed.

here's example how my plugin worked before starting to use perl-Monitoring-Plugin, and after

➔ ./check_raid-3.2.5.pl --help | head -n10
check_raid, v3.2.5
Copyright (c) 2004-2006 Steve Shipway,
Copyright (c) 2009-2015, Elan Ruusamäe <[email protected]>

This plugin reports the current server's RAID status
https://github.com/glensc/nagios-plugin-check_raid

Usage: check_raid [-h] [-V] [-S] [list of devices to ignore]
➔ ./check_raid-4.0.1.pl --help | head -n10
check_raid 4.0.1

This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the GNU
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).

This plugin checks all RAID volumes (hardware and software) that can be identified.

Usage: check_raid [-h] [-V] [-S] [list of devices to ignore]

Possible modifications to message methods

Hi,
since message methods are marked as experimental in Monitoring::Plugin documentation, I made my own methods for a plugin I wrote some time ago (not wanting to depend on something which may change without notice). Since I need them now for another plugin, I'm facing the problem of sharing that code between the two scripts, trying to keep around as less extra modules as possible.

Ideally, the best solution would be to integrate those methods into Monitoring::Plugin distribution (if you like the way they work). Is this a possibility we can discuss?

You can find the code I made into: https://github.com/kromg/nagios-plugins/blob/master/check_end2end.pl, it's the Monitoring::Plugin::Ens2End package. The package can also keep track of the current status of the check, it's made to handle those checks where the overall exit status is built from many sub-checks.

Thanks,
Giacomo

Performance.pm->perfoutput does not handle empty value correctly

I use check_squid.pl developed by Cyril Feraudet in Version 1.1

That uses package Nagios::Plugin which is version 0.36

The script gives out invalid performance data because value is sometimes empty and that is not handleded correctly and leads to invalid performance data output.

check_squid.pl creates a new Nagios::Plugin object and then adds the performance value with method add_perfdata

pnp4nagios claims invalid performance data, which is true, because after the = sign comes directly the UOM:

2015-11-27 11:45:06 [2996] [1] Found Performance Data for MYHOST / Squid_Cache ('Requests Hit Ratio 5min'=0.0%;; 'Requests Hit Ratio 60min'=0.2%;; 'Byte Hit Ratio 5min'=%;; 'Byte Hit Ratio 60min'=%;;)
2015-11-27 11:45:06 [2996] [1] Invalid Perfdata detected

I did a workaround for this in Performance.pm perfoutput method like so:

sub perfoutput {
    my $self = shift;
    # Add quotes if label contains a space character
    my $label = $self->label;
    if ($label =~ / /) {
        $label = "'$label'";
    }

    my $value = $self->value;

    if ($value eq '') {
        $value = 'U';
    }

    my $out = sprintf "%s=%s%s;%s;%s;%s;%s",
        $label,
        $value,
        $self->_nvl($self->uom),
        $self->_nvl($self->warning),
        $self->_nvl($self->critical),
        $self->_nvl($self->min),
        $self->_nvl($self->max);
    # Previous implementation omitted trailing ;; - do we need this?
    $out =~ s/;;$//;

    return $out;
}

So if value is empty, it is changed to value "U" which means that the value could not have been determined, according to Nagios Plugin development guidelines, section Performance data.

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.