Missing perl module using a perl plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mikimpc
Posts: 8
Joined: Tue Sep 22, 2015 10:50 am

Missing perl module using a perl plugin

Post 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!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Missing perl module using a perl plugin

Post by rkennedy »

What happens if you run the command over command line?
Former Nagios Employee
mikimpc
Posts: 8
Joined: Tue Sep 22, 2015 10:50 am

Re: Missing perl module using a perl plugin

Post 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"
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Missing perl module using a perl plugin

Post 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
Former Nagios Employee.
me.
mikimpc
Posts: 8
Joined: Tue Sep 22, 2015 10:50 am

Re: Missing perl module using a perl plugin

Post 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"?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Missing perl module using a perl plugin

Post 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?
Former Nagios Employee.
me.
mikimpc
Posts: 8
Joined: Tue Sep 22, 2015 10:50 am

Re: Missing perl module using a perl plugin

Post by mikimpc »

I'm running Nagios Core in Ubuntu 14.04.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Missing perl module using a perl plugin

Post by hsmith »

In that case, use apt-get instead of yum.
Former Nagios Employee.
me.
Locked