Page 1 of 1

Missing perl module using a perl plugin

Posted: Mon Nov 30, 2015 7:33 am
by mikimpc
Hello everyone, I want to use a plugin called check_printer_info, this is a perl plugin. I've downloaded it, copied the .pl file in my nagios plugins, correct rights to use this, and calling it in my definitions, but the result is the follow:
(No output on stdout) stderr: Can't locate Nagios/Plugin.pm in @INC (you may need to install the Nagios::Plugin module) (@INC contains: /usr/local/nagios/libexec/../perl/lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/nagios/libexec/check_printer_info.pl line 42.

I guess that something is missing in my Ubuntu related with PERL, but I'm lost.... This is my first Perl plugin in my Ngios Core, all other plugins are running fine.
This is my code:

define command{
command_name check_printer
command_line $USER1$/check_printer_info.pl -H $HOSTADDRESS$ -T hp
}

define service{
use generic-service
host_name printer1
check_command check_printer
}

Thank you!

Re: Missing perl module using a perl plugin

Posted: Mon Nov 30, 2015 11:38 am
by rkennedy
What happens if you run the command over command line?

Re: Missing perl module using a perl plugin

Posted: Mon Nov 30, 2015 12:20 pm
by mikimpc
Exactly the same... :-(

The code of this plugin, says....

# Fins the Nagios::Plugin lib. Change this path if necessary
use FindBin
use lib "$FindBin::Bin/../perl/lib";
use Nagios::Plugin qw(%ERRORS);


If I use this command from command line "which perl", it returns "/usr/bin/perl"

Re: Missing perl module using a perl plugin

Posted: Mon Nov 30, 2015 12:36 pm
by hsmith
I am not 100% sure if this will fix the issue, but can you try the following?

Code: Select all

cd /tmp
yum install -y 'perl(Test::Simple)' 'perl(Class::Accessor)' perl-Params-Validate perl-Config-Tiny perl-Math-Calc-Units
wget https://cpan.metacpan.org/authors/id/N/NA/NAGIOS/Nagios-Monitoring-Plugin-0.51.tar.gz
perl Makefile.PL
make
make test
make install

Re: Missing perl module using a perl plugin

Posted: Wed Dec 02, 2015 7:51 am
by mikimpc
Many thanks, by the moment I've been using another plugin called check_hpjd, it works for all we need.
Anyway, there is an alternative to "yum"?

Re: Missing perl module using a perl plugin

Posted: Wed Dec 02, 2015 10:56 am
by hsmith
Technically, but yum is what is used in RHEL/CentOS by default and switching it is going to be pretty terrible. You could look into dnf, but switching your package manager is not trivial, and may break more than it fixes. What is your reason for wanting to not use yum?

Re: Missing perl module using a perl plugin

Posted: Tue Dec 15, 2015 6:53 am
by mikimpc
I'm running Nagios Core in Ubuntu 14.04.

Re: Missing perl module using a perl plugin

Posted: Tue Dec 15, 2015 10:31 am
by hsmith
In that case, use apt-get instead of yum.