Is it possible to include/use directly perl's Nagios::Plugin without installing it?

orlybg asked:

I am a web developer needing to monitor a vast array of servers with nagios and have to write some perl scripts for it.

Looking into it I found Nagios::Plugin package from CPAN, but the servers don’t have it, and I am not allowed to do a CPAN install (not even sure all of them have it) much less do a make, make install.

I guess probably there’s a way to just download the tarball, uncompress it, and include/require it withing your perl script, don’t know maybe specifying the absolute path and such.


I found this script to look for the packages Nagios::Plugin, but to no avail


use strict;
use warnings;

eval { require Nagios::Plugin && Nagios::Plugin->import };
if ([email protected]) {
# assume a relatively recent Perl where FindBin is in core
no warnings;
require FindBin;
unshift @INC, map "$FindBin::Bin/$_",
qw(perl lib perl/lib ../perl ../lib ../perl/lib);
local $" = "\n\t";
eval {
require Nagios::Plugin && Nagios::Plugin->import
or die "Couldn't locate Nagios::Plugin in \n\[email protected]\n";

My answer:

This particular package is in the EPEL repository for Red Hat based systems, so if you’re managing those you could simply install the perl-Nagios-Plugin RPM.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.