Updated PERL but Nagios doesn't seem to see it
Updated PERL but Nagios doesn't seem to see it
I was having an issue with the version of PERL that was installed on the nagios server not being able to do some of the things I wanted the scripts to do. I have since then upgraded the version of PERL and see that the scripts are running when run from the command prompt on the machine.
The problem I'm having is that the checks are still failing with the old error when run through nagios. Is there a way to make sure nagios is using the latest version of PERL and not the old one?
The problem I'm having is that the checks are still failing with the old error when run through nagios. Is there a way to make sure nagios is using the latest version of PERL and not the old one?
Re: Updated PERL but Nagios doesn't seem to see it
What errors are you getting? Are these internal written scripts?
You can run the following from the CLI, and should tell you what version the system thinks you are running:
and
You can run the following from the CLI, and should tell you what version the system thinks you are running:
Code: Select all
perl -VCode: Select all
which perlRe: Updated PERL but Nagios doesn't seem to see it
perl -V returns with perl 5.21.7
We also have perl 5.8.8 installed on the machine (legacy reasons).
The script is internally written and when executed with perl 5.8.8 it returns the following error:
LWP will support https URLs if the LWP::Protocol::https module is installed (this module will not install on perl 5.8.8...)
When executed with the perl 5.21.7, which has https module installed, we get that the check executes fine.
After testing with 5.21.7 and changing the script to have the shebang of /usr/bin/env perl instead of /usr/bin/perl: execution through Nagios still returns the same error that 5.8.8 returns. This led me to think that Nagios is still using the older version of perl and that there might be a setting that needs changing.
We also have perl 5.8.8 installed on the machine (legacy reasons).
The script is internally written and when executed with perl 5.8.8 it returns the following error:
LWP will support https URLs if the LWP::Protocol::https module is installed (this module will not install on perl 5.8.8...)
When executed with the perl 5.21.7, which has https module installed, we get that the check executes fine.
After testing with 5.21.7 and changing the script to have the shebang of /usr/bin/env perl instead of /usr/bin/perl: execution through Nagios still returns the same error that 5.8.8 returns. This led me to think that Nagios is still using the older version of perl and that there might be a setting that needs changing.
Re: Updated PERL but Nagios doesn't seem to see it
Just to make sure nagios wasn't using the embedded perl interpreter, I've added the #nagios: -epn to the code. Still get the same response.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Updated PERL but Nagios doesn't seem to see it
I wonder if the other version of perl is in the nagios users path as well, can you run
Code: Select all
su nagios -c 'perl -V'Re: Updated PERL but Nagios doesn't seem to see it
Here's the output:
It does reference the perlbrew 5.21.7 at the bottom, but it seems like it is primarily describing 5.8.8
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.18-371.6.1.el5, archname=i386-linux-thread-multi
uname='linux builder17.centos.org 2.6.18-371.6.1.el5 #1 smp wed mar 12 20:03:51 edt 2014 i686 athlon i386 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux-thread-multi -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-55)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Oct 30 2014 10:42:20
%ENV:
PERLBREW_BASHRC_VERSION="0.71"
PERLBREW_HOME="/root/.perlbrew"
PERLBREW_MANPATH="/root/perl5/perlbrew/perls/perl-5.21.7/man"
PERLBREW_PATH="/root/perl5/perlbrew/bin:/root/perl5/perlbrew/perls/perl-5.21.7/bin"
PERLBREW_PERL="perl-5.21.7"
PERLBREW_ROOT="/root/perl5/perlbrew"
PERLBREW_VERSION="0.71"
@INC:
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8
.
It does reference the perlbrew 5.21.7 at the bottom, but it seems like it is primarily describing 5.8.8
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.18-371.6.1.el5, archname=i386-linux-thread-multi
uname='linux builder17.centos.org 2.6.18-371.6.1.el5 #1 smp wed mar 12 20:03:51 edt 2014 i686 athlon i386 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux-thread-multi -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-55)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Oct 30 2014 10:42:20
%ENV:
PERLBREW_BASHRC_VERSION="0.71"
PERLBREW_HOME="/root/.perlbrew"
PERLBREW_MANPATH="/root/perl5/perlbrew/perls/perl-5.21.7/man"
PERLBREW_PATH="/root/perl5/perlbrew/bin:/root/perl5/perlbrew/perls/perl-5.21.7/bin"
PERLBREW_PERL="perl-5.21.7"
PERLBREW_ROOT="/root/perl5/perlbrew"
PERLBREW_VERSION="0.71"
@INC:
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8
.
Re: Updated PERL but Nagios doesn't seem to see it
How was 5.21.7 installed? From source, third party rpm, or through yum?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Updated PERL but Nagios doesn't seem to see it
Third party - through perlbrew
My path variable is setup to have the perlbrew at the beginning. Is there a way to make nagios use the /bin/usr/env perl instead of /bin/usr/perl?
My path variable is setup to have the perlbrew at the beginning. Is there a way to make nagios use the /bin/usr/env perl instead of /bin/usr/perl?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Updated PERL but Nagios doesn't seem to see it
you may have this in the env for root, but it needs to be in the env for the nagios user.
Also, the references in the bottom point to a path of /root/perl5/perlbrew/bin which the mnagios user will not be able to access....
You would need to install this in a path that the nagios user can access and then I would reference the direct path to the perl file if you need to leave multiple versions of perl on the system
Also, the references in the bottom point to a path of /root/perl5/perlbrew/bin which the mnagios user will not be able to access....
You would need to install this in a path that the nagios user can access and then I would reference the direct path to the perl file if you need to leave multiple versions of perl on the system
Re: Updated PERL but Nagios doesn't seem to see it
Thank you all for your assistance! I was able to get it working by installing a local copy of perl for the nagios user and installing the proper LWP::Protocol::https on there. Don't know if this is optimal but it works!