SNMPTT and perl snmp module troubleshooting - perl

I'm on centos6.7 and i need to install snmptt to get all SNMP traps and log them into Nagios. I made it work yesterday, but today, not the same story...
I've run the yum install perl-Net-SNMP command, it told me that the package is already installed (from epel)
I've enabled the module on the snmptt.ini and now, when i'm trying to run it, I've a failed message :
root#SLINUX01:[~]$service snmptt restart
Stopping snmptt: [FAILED]
Starting snmptt: Can't locate SNMP.pm in #INC (#INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at (eval 12) line 1.
Could not load the Perl module SNMP! If net_snmp_perl_enable is
enabled then the SNMP module is required. Please see snmptt.html
for system requirements. Note: SNMPTT uses the Net-SNMP package's
SNMP module, NOT the CPAN Net::SNMP module!
died at /usr/sbin/snmptt line 426.
Suggestions ?

Found the solution : just install a different package :
yum install net-snmp-perl =/= yum install perl-Net-SNMP

The provided solution also worked for SNMPTT on Oracle Linux 7.5.
yum install net-snmp-perl
worked for me.

Related

Installing Perl Module in specified directory

I am trying to install one of the Perl module in my server (ubuntu droplet from Digital Ocean). I wanted this module to be installed in /home/vinod/my_test_folder/perl_practice/scripts/lib/ directory which I have already created.
This is specific to one module. I don't want to install it in default path like /usr/bin/perl. I wanted it to be installed in above mentioned path.
Here are the list of commands which I executed to install the Email::Reply perl module.
Downloaded module from metacpan
tar xvfz Email-Reply-1.204.tar.gz
cd Email-Reply-1.204/
perl Makefile.PL PREFIX=/home/vinod/my_test_folder/perl_practice/scripts/lib/
su
<password_for_root>
make
make test
make install
When I execute make install command the following output got displayed on terminal screen
Manifying 1 pod document
Installing /home/vinod/my_test_folder/perl_practice/scripts/lib/share/perl/5.26.1/Email/Reply.pm
Installing /home/vinod/my_test_folder/perl_practice/scripts/lib/man/man3/Email::Reply.3pm
Appending installation info to /home/vinod/my_test_folder/perl_practice/scripts/lib//lib/x86_64-linux-gnu/perl/5.26.1/perllocal.pod
And I could see the module got installed in /home/vinod/my_test_folder/perl_practice/scripts/lib/share/perl/5.26.1/Email/Reply.pm path, which is not right path which I mentioned in PREFIX=.
Strange thing here I wrote one small script which uses Email::Reply module by mentioning module path in shebang line
Code below:
#!/usr/bin/perl -I/home/vinod/my_test_folder/perl_practice/scripts/lib/share/perl/5.26.1/
use EMail::Reply;
print "Hi\n";
still its throws an error
Can't locate EMail/Reply.pm in #INC (you may need to install the EMail::Reply module) (#INC contains: /home/vinod/my_test_folder/perl_practice/scripts/lib/share/perl/5.26.1/ /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3.
I want this module to be installed in /home/vinod/my_test_folder/perl_practice/scripts/lib/
How to achieve this. Please help me.
This is what local::lib can be used for, and cpanm supports it by default:
$ cpanm -l /home/vinod/my_test_folder/perl_practice/scripts Email::Reply
This will install it to /home/vinod/my_test_folder/perl_practice/scripts/lib/perl5.
Alternatively you can recreate the options local::lib sets for this case, the important one for this case is PERL_MM_OPT.
$ env PERL_MM_OPT='INSTALL_BASE=/home/vinod/my_test_folder/perl_practice/scripts' cpanm Email::Reply
Importantly, note that all of this is case sensitive, you must use Email::Reply;.

CPAN on Ubuntu Can't locate local/lib.pm

I just set up an Ubuntu 16.04 box and am trying to get some Perl modules installed. I launched CPAN, and it went through the automatic config procedure. At the end it dumped a few questionable messages:
Couldn't untar local-lib-2.000019.tar: 'Cannot allocate memory'
'YAML' not installed, will not store persistent state
HAARG/local-lib-2.000019.tar.gz
Had problems unarchiving. Please build manually
Can't locate local/lib.pm in #INC (you may need to install the local::lib module) (#INC contains: /home/steve/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base /home/steve/waternow) at /usr/share/perl/5.22/CPAN/FirstTime.pm line 1347.
When I restarted it, it came up with the CPAN shell command line like nothing is wrong. Did it get configured correctly, or is there something else I need to do? I'm not a Lunix noob but not an expert either.
Also are there any better options for installing Perl modules on Ubuntu besides CPAN (for example like Activestate Perl Package Manager on Windows)? I've never been too fond of CPAN because of experiences like this.

Perl : can't install dependency using cpan

I have a scsript that uses package LWP::Curl
But when I try to install it using this command [sudo cpanm install LWP::Curl] get the following error :-
Fetching http://www.cpan.org/authors/id/S/SY/SYP/Net-Curl-0.37.tar.gz
-> OK
Unpacking Net-Curl-0.37.tar.gz
Entering Net-Curl-0.37
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker::Config 0 ... Yes (6.66)
Configuring Net-Curl-0.37
Running Makefile.PL
pkgconfig failed:
Can't locate ExtUtils/PkgConfig.pm in #INC (you may need to install the ExtUtils::PkgConfig module) (#INC contains: /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 Makefile.PL line 39.
Using curl-config script.
Can't exec "curl-config": No such file or directory at Makefile.PL line 212.
curl-config failed:
Execution curl-config --vernum failed.
is your libcurl installed correctly ?
libcurl development files do not seem to be available
You must install libcurl 7.15.5 or newer to
build this module
NA: Unable to build distribution on this platform.
-> N/A
-> FAIL Configure failed for Net-Curl-0.37. See /home/harsh/.cpanm/work/1460968559.18563/build.log for details.
I am new to Perl , How can this be resolved?
Sounds like a bug in the Net::CURL package and it fails to list its dependencies correctly.
Install ExtUtils::PkgConfig first (just like the error message says).
Then install libcurl (the -dev version if your platform distinguishes between that and the base package) using your platform's package management system (again, like the error message says).

Bugzilla 5.0 install on OpenShift - Can't locate parent.pm in #INC

Attempting to install Bugzilla on an OpenShift small gear. Using SSH to wget 5.0 tarball, untar-ing and running the checksetup.pl --check-modules script gives me this error:
Can't locate parent.pm in #INC (INC contains: . lib /var/openshift/[app-id]/app-root
/runtime/repo/libs /var/lib/openshift/[app-id]/perl/perl5lib/lib/perl5 /usr/local/lib64
/perl5 /usr/local/share/perl5 /usr/lib/lib64/perl5/vendor-perl /usr/share/perl5/vendor-perl
/usr/lib64/perl5 usr/share/perl5) at Bugzilla/Constants.pm line 14.
BEGIN failed--compilation aborted at Bugzilla/Constants.pm line 14.
Compilation failed in require at ./checksetup.pl line 27.
BEGIN failed--compilation aborted at ./checksetup.pl line 27.
Line 14 of Bugzilla/Constants.pm: `use parent qw(Exporter);`
Line 27 of ./checksetup.pl: `use Bugzilla::Constants;`
[app-id] in the paths is just a random string of hex digits used to identify an OpenShift application.
All help would be greatly appreciated. Thanks in advance!
That means either parent is not installed in your system or it's not a part of #INC.
Try perldoc -l parent to see if it's installed or not.
If it's installed then update PERL5LIB enviroment variable to add path to directory where module is installed.
If it's not installed then run cpan parent to install.
Also see:
How do I 'use' a Perl module in a directory not in #INC?
How to change #INC to find Perl modules in non-standard locations
Apparantly OpenShift has a cpan.txt file in the .openshift folder. Adding parent to that folder installed the required module.
#please install above packages:
[root#rsync ~]# yum install perl-parent -y

Cannot locate a perl module

I am trying to run a topology generation tool (http://informatique.umons.ac.be/networks/igen/) on linux where I need to install plenty of modules of perl.
For now, I have already installed CPAN. This tool requires a Statistics::Basic module which I also installed successfully.
However, after installing this module, the tool requires a package in this Statistics::Basic module. Here are the hints appeared in the command line:
Can't locate Statistics/Basic/CoVariance.pm in #INC (you may need to install the Statistics::Basic::CoVariance module) (#INC contains: /usr/local/share/perl/5.18.2/ /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 .)
I get confused on this request since it is already included in the Statistics::Basic module. Even though I tried to install it independently, the cpan responded this:
cpan[1]> install Statistics::Basic::CoVariance
Warning: Cannot install Statistics::Basic::CoVariance, don't know what it is.
Does anyone know how to fix it? I am new to perl so I don't know how to make it work. Thx.
You need to replace the capital V with a small v in a couple of files and you need also some other modifications. You can find here a guide on how to make IGen-0.15 work again.