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 ($@) {
# 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\t@INC\n";

closed as not constructive by mgorven, mdpc, kce, Ward, Wesley Feb 7 '13 at 5:39

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

  • This could be what you are looking for - stackoverflow.com/questions/251705/… – Daniel t. Feb 6 '13 at 18:48
  • You state that you are a web developer and that you are not allowed to have CPAN installed on your web servers (presumably by your operations or systems teams). You should work with them to see what kind of monitoring services are available in your environment. – kce Feb 7 '13 at 3:55

It appears to be a pure-perl module, so yes, in theory you could unpack it and load it without running make. Note that you'd need to already have all the required modules listed in Makefile.PL or the module won't work.

If you unpack it into ~/Nagios-Plugin-0.36/, and your script is in ~/script, then you could do:

mkdir ~/script/lib

cp -R ~/Nagios-Plugin-0.36/lib/ ~/script/lib/

And then the script snippet you posted above should be able to load the module.

Good luck!

  • thank you so much, trying it right now... (yeah the dependencies are a concern) – orlybg Feb 6 '13 at 18:36

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.

  • Indeed the servers are running centos, but there's still the issue of not being allowed to install stuff. – orlybg Feb 6 '13 at 23:18
  • 1
    If they won't let you install an RPM package, you need to fix the business process first. – Michael Hampton Feb 7 '13 at 1:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.