Perl Nagios::Plugin vs Monitoring::Plugin

Sven Nierlein Sven.Nierlein at Consol.de
Fri Sep 8 14:24:54 CEST 2017


Hi,

you could use Module::Load (which is a perl core module) to do that:

use Module::Load qw/load/;
eval {
  load Monitoring::Plugin, qw/required exports/;
};
if($@) {
  load Nagios::Plugin, qw/required exports/;
}

Or just stay with Nagios::Plugin till the old systems fade out. You can use Monitoring::Plugin by the name "Nagios::Plugin" as well. It comes
with a compatibility module.

Cheers,
 Sven

On 08/09/17 14:16, Florian Lohoff wrote:
> > Hi, > > i am trying to have perl checks supported on hosts from Debian/Squeeze > up to Debian/Stretch. Squeeze->Jessie have Nagios::Plugin, > Wheezy->Stretch have Monitoring plugin. > > So i was trying around in loading one or the other conditionally > > eval { > require Nagios::Plugin; > 1; > } or do { > require Monitoring::Plugin; > } > > Now i fail to find a way to get all the exports e.g. > CRITICAL/WARNING/OK/UNKNOWN. > > Is there a nice generic way to support either perl module? > > Flo

-- 
Sven Nierlein             Sven.Nierlein at consol.de
ConSol* GmbH              http://www.consol.de
Franziskanerstrasse 38    Tel.:089/45841-439
81669 Muenchen            Fax.:089/45841-111




More information about the Devel mailing list