Re: Perl Nagios::Plugin vs Monitoring::Plugin

Sven Nierlein <[email protected]> Fri, 8 Sep 2017 14:24:54 +0200
Newsgroups gmane.network.nagios.devel
Message-ID <8ba8cafa-6386-e1ca-6c64-ad5d5c9a9de4__15757.9844854356$1504873514$gmane$org@consol.de>
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             [email protected]
ConSol* GmbH              http://www.consol.de
Franziskanerstrasse 38    Tel.:089/45841-439
81669 Muenchen            Fax.:089/45841-111