PERL Scripts are not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

PERL Scripts are not working

Post by absarcompass »

Hi Guys,
I am trying to migrate few services from Nagios Core 3.5.1 to NagiosXI 5.2.7
The Plugins used in the services are written in Perl (i guess as they have .pl extension) those scripts are not working in NagiosXI
e.g
[root@nagiosxi libexec]# ./check_sql-query.pl -u XXXX -p @@@@ -h x.x.x.x -d Monitor -w 0:100 -c 0:250 -s 'SELECT top 1 Noupload FROM Switchmonitor order by TrafficDate Desc' -T MSSQL
install_driver(ODBC) failed: Can't locate DBD/ODBC.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3.
Perhaps the DBD::ODBC perl module hasn't been fully installed,
or perhaps the capitalisation of 'ODBC' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge, mysql.
at ./check_sql-query.pl line 310
Only thing i can see with my novice knowledge is :
At NagiosXI
[root@nagiosxi libexec]# locate ODBC.pm
/usr/lib64/perl5/DBI/Const/GetInfo/ODBC.pm
[root@nagiosxi libexec]#
[root@nagiosxi libexec]# perl -version

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
At Nagios Core
monica2 plugins # locate ODBC.pm
/root/.cpan/build/DBD-ODBC-1.29-brm9xO/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.29-yfwSzG/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.29-yfwSzG/blib/lib/DBD/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.33-D3t59s/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.33-D3t59s/blib/lib/DBD/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.45-220YiI/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.45-220YiI/blib/lib/DBD/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.45-HRYwZV/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.45-HRYwZV/blib/lib/DBD/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.48-6NK3Ec/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.48-6NK3Ec/blib/lib/DBD/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.50-yGlFGn/ODBC.pm
/root/.cpan/build/DBD-ODBC-1.50-yGlFGn/blib/lib/DBD/ODBC.pm
/root/.cpan/build/DBI-1.633-Wnl5Eq/blib/lib/DBI/W32ODBC.pm
/root/.cpan/build/DBI-1.633-Wnl5Eq/blib/lib/DBI/Const/GetInfo/ODBC.pm
/root/.cpan/build/DBI-1.633-Wnl5Eq/blib/lib/Win32/DBIODBC.pm
/root/.cpan/build/DBI-1.633-Wnl5Eq/lib/DBI/W32ODBC.pm
/root/.cpan/build/DBI-1.633-Wnl5Eq/lib/DBI/Const/GetInfo/ODBC.pm
/root/.cpan/build/DBI-1.633-Wnl5Eq/lib/Win32/DBIODBC.pm
/usr/lib64/perl5/vendor_perl/5.20.2/x86_64-linux/DBI/W32ODBC.pm
/usr/lib64/perl5/vendor_perl/5.20.2/x86_64-linux/DBI/Const/GetInfo/ODBC.pm
/usr/lib64/perl5/vendor_perl/5.20.2/x86_64-linux/Win32/DBIODBC.pm
/usr/local/lib64/perl5/5.16.3/x86_64-linux/DBD/ODBC.pm
/usr/local/lib64/perl5/5.18.2/x86_64-linux/DBD/ODBC.pm
/usr/local/lib64/perl5/5.20.2/x86_64-linux/DBD/ODBC.pm
/usr/local/lib64/perl5/5.20.2/x86_64-linux/DBI/W32ODBC.pm
/usr/local/lib64/perl5/5.20.2/x86_64-linux/DBI/Const/GetInfo/ODBC.pm
/usr/local/lib64/perl5/5.20.2/x86_64-linux/Win32/DBIODBC.pm
monica2 plugins #
monica2 plugins # perl -version

This is perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux
(with 27 registered patches, see perl -V for more detail)

Copyright 1987-2015, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

monica2 plugins #
I have run through google, tried updating Perl by CPAN(Sigh!! know nothing about it just followed some tutorial), had no luck. Thankfully had the snapshot :D
I am unable to pin point the problem here:S may be it is something with Database or some back-end dependencies (like i said, Novice)
Also there are services for Voice traffic as well to gauge the MOS score and concurrent calls & call failures which i can not move because of this Perl thing.
Can't find any plugin for such in NagiosXI. Services based on perl scripts are working fine in Old Nagios Core.
Can any one please help me here.

Thanks!!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: PERL Scripts are not working

Post by Box293 »

Try:

Code: Select all

yum install -y perl-DBD-ODBC
If that doesn't work can you upload the plugin or provide a link to it please.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: PERL Scripts are not working

Post by absarcompass »

Hi Box293,
I will try that and will let you guys know the result.

Thanks
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: PERL Scripts are not working

Post by rkennedy »

Sounds good - let us know how it goes!
Former Nagios Employee
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: PERL Scripts are not working

Post by absarcompass »

Hi Guys,
It has tried and failed all the mirrors.
http://epel.mirror.freedomvoice.com/6/x ... x86_64.rpm: [Errno 12] Timeout on http://epel.mirror.freedomvoice.com/6/x ... x86_64.rpm: (28, 'connect() timed out!')
Trying other mirror.
http://fedora.mirror.nexicom.net/epel/6 ... x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'fedora.mirror.nexicom.net'"
Trying other mirror.
http://mirrors.einstein.yu.edu/epel/6/x ... x86_64.rpm: [Errno 12] Timeout on http://mirrors.einstein.yu.edu/epel/6/x ... x86_64.rpm: (28, 'connect() timed out!')
Trying other mirror.

Error Downloading Packages:
perl-DBD-ODBC-1.48-1.el6.x86_64: failure: perl-DBD-ODBC-1.48-1.el6.x86_64.rpm from epel: [Errno 256] No more mirrors to try.
nagiosxi ~]# yum whatprovides perl-DBD-ODBC
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not get metalink https://mirrors.fedoraproject.org/metal ... rch=x86_64 error was
14: problem making ssl connection
* base: centos.uberglobalmirror.com
* epel: dl.fedoraproject.org
* extras: mirror.as24220.net
* rpmforge: apt.sw.be
* updates: mirror.as24220.net
perl-DBD-ODBC-1.48-1.el6.x86_64 : ODBC Driver for DBI
Repo : epel
Matched from:



perl-DBD-ODBC-1.23-1.el6.rf.x86_64 : Perl DBD module for interfacing with ODBC databases
Repo : rpmforge
Matched from:

nagiosxi ~]# yum repolist enabled
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not get metalink https://mirrors.fedoraproject.org/metal ... rch=x86_64 error was
14: problem making ssl connection
* base: centos.uberglobalmirror.com
* epel: dl.fedoraproject.org
* extras: mirror.as24220.net
* rpmforge: apt.sw.be
* updates: mirror.as24220.net
repo id repo name status
base CentOS-6 - Base 6,575
cr CentOS-6 - CR 0
epel Extra Packages for Enterprise Linux 6 - x86_64 11,092
extras CentOS-6 - Extras 62
nagios-base Nagios 166
nagiosxi-deps Nagios XI Dependencies 33
rpmforge RHEL 6 - RPMforge.net - dag 4,718
updates CentOS-6 - Updates 1,555
vmware-tools-collection vmware-tools-collection 43
repolist: 24,244
Do I need to install anything else prior to this?
Or am i missing something in between?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: PERL Scripts are not working

Post by Box293 »

Try this:

Code: Select all

yum upgrade ca-certificates --disablerepo=epel
Then retry the steps I provided previously.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: PERL Scripts are not working

Post by absarcompass »

Thanks guys,
Atleast perl thing is not showing up as an error.
But now i am getting this
Could not connect to msdb on MARVIN: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
I copied the odbc.ini & odbcinst.ini with same permissions and owners.
freetds conf file has been replicated too (done all changes with having original file's backup)

Both Nagios are in same network so no explicit rule of access is implied. Both Nagios can ping DB server.

Any thing that i am missing here ???
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: PERL Scripts are not working

Post by rkennedy »

Can you show us the full input that produced the pasted result above?

Also, from the Nagios machine, please run nmap ipofclientmachine (replace ipofclientmachine as necessary)
Former Nagios Employee
absarcompass
Posts: 182
Joined: Thu May 14, 2015 9:57 pm

Re: PERL Scripts are not working

Post by absarcompass »

Hi,

These are two of the commands (plugins) that are failing in XI and working in Core (I have removed password)
[root@nagiosxi libexec]# ./plugin_capture.pl /usr/local/nagios/libexec/check_sql-jobhistory.pl -h MARVIN -u nagios -p xxxxxx -d 1 -m 2


Could not connect to msdb on MARVIN: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)[root@nagiosxi libexec]#
[root@nagiosxi libexec]# ./check_sql-query.pl -u nagios -p xxxxxx -h MARVIN -d Monitor -w 0:100 -c 0:250 -s 'SELECT top 1 Noupload FROM Switchmonitor_Ezipay order by TrafficDate Desc' -T MSSQL
Unknown

Could not connect to Monitor on MARVIN: [root@nagiosxi libexec]#
nmap results same on both Nagios core and XI

[root@nagiosxi ~]# nmap 192.168.224.19

Starting Nmap 6.47 ( http://nmap.org ) at 2016-04-19 10:47 NZST
Nmap scan report for 192.168.224.19
Host is up (0.010s latency).
Not shown: 981 closed ports
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
1433/tcp open ms-sql-s
2383/tcp open ms-olap4
3389/tcp open ms-wbt-server
5357/tcp open wsdapi
8009/tcp open ajp13
8080/tcp open http-proxy
8084/tcp open unknown
34571/tcp open unknown
34572/tcp open unknown
49152/tcp open unknown
49153/tcp open unknown
49154/tcp open unknown
49155/tcp open unknown
49159/tcp open unknown
49167/tcp open unknown
monica2 ~ # nmap 192.168.224.19

Starting Nmap 6.47 ( http://nmap.org ) at 2016-04-19 10:48 NZST
Nmap scan report for 192.168.224.19
Host is up (0.0013s latency).
Not shown: 981 closed ports
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
1433/tcp open ms-sql-s
2383/tcp open ms-olap4
3389/tcp open ms-wbt-server
5357/tcp open wsdapi
8009/tcp open ajp13
8080/tcp open http-proxy
8084/tcp open unknown
34571/tcp open unknown
34572/tcp open unknown
49152/tcp open unknown
49153/tcp open unknown
49154/tcp open unknown
49155/tcp open unknown
49159/tcp open unknown
49167/tcp open unknown
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: PERL Scripts are not working

Post by tgriep »

Can you upload the perl script you are using so we can review it?

One thing to look at is the /etc/odbc.ini file on each system.
Look at the working one and add any missing entries to the Xi server and see if that resolves the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked