Undefined subroutine &Util::disconnect called at /usr/local/nagios/libexec/check_esx3-0.5.pl line 555 - perl

I want to monitor an esxi server with the Nagios plugin check_esxi. I am getting this error when executing it:
Undefined subroutine &Util::disconnect called at /usr/local/nagios/libexec/check_esx3-0.5.pl line 555
I followed these installation instructions. The Perl libraries and its modules are installed:
Nagios::Plugin via CPAN
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload CPAN
cpan> install Nagios::Plugin
cpan> install Crypt::SSLeay
cpan> install Compress::Zlib
Despite that, the error (which seems to point to a missing library) still occurs.

Util::disconnect() is defined in VMware::VIRuntime, which can be found in VILib.pm, which is part of the VMware vSphere SDK for Perl API. You have to install VMware vSphere SDK for Perl API in order to run check_esx3.pl.
Installation instructions can be found here: https://kb.op5.com/display/HOWTOs/How+to+Install+VMware+vSphere+SDK+for+Perl+5.1
More information (for instance: links to the source) can be found here: https://www.vmware.com/support/developer/viperltoolkit/viperl-1-200706-releasenotes.html

The correct module name where Util::disconnect() is defined is /usr/local/share/perl5/VMware/VICommon.pm
VMware apparently discontinued its support for the VIPER (VMware Infrastructure Perl) SDK.
I ended up locating old 32-bit installation package and placed / modified files manually.

Related

Why doesn't perl find my installed SSH2 module?

So I am trying to run a perl script on my Centos machine. I have tried on Centos 5,6,7 with no success. Every time I run the script I get this:
Can't locate Net/SSH2.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 .)
I have installed libssh2
Package libssh2-1.4.3-12.el7.x86_64 already installed and latest version
I have tried using cpan but no matter what I do it doesn't seem to work.
I just don't understand why perl isn't finding the module... Am I missing something?
If somebody could guide me to actually installing the SSH2 module because I have looked everywhere and nothing seems to work.
Thanks in advance.
UPDATE:
When I try to install via cpan:
cpan[1]> install Net::SSH2
Reading '/root/.cpan/Metadata'
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
........................................................................DONE
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Fri, 04 Jan 2019 22:17:03 GMT
HTTP::Date not available
.............
New CPAN.pm version (v2.22) available.
[Currently running version is v1.9800]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
........................................Killed
Still getting the same error...
libssh is the C library for SSH. Net::SSH2 is a Perl module. They are different piece of software (although Net::SSH2 probably depends on libssh).
You need to install Net::SSH2.
See What's the easiest way to install a missing Perl module?
As Quentin mentioned in his answer, libssh2 is the C library for SSH, whereas Net::SSH2 is a Perl module. Since Net::SSH2 will be installed from source (which is what the cpan command does in the background), you will need to ensure that a few prerequisites are installed:
sudo yum install libssh2 libssh2-devel gcc
The libssh2 package was added to this list for completeness. The development package for libssh2 (libssh2-devel) as well as gcc (a C compiler) are required, since the process of installing Net::SSH2 from source requires a library to be built so that Net::SSH2 can talk to libssh2.
When Perl modules are installed from source, the module's test suite is run by default to check that everything is ok before actually running the install step. Hence, you will need to ensure that perl-Test-Simple is installed, since Net::SSH2 uses this to run its tests:
sudo yum install perl-Test-Simple
I personally find it much easier to install Perl modules via cpanm than cpan, thus I recommend installing it (it's available as a yum package):
sudo yum install perl-App-cpanminus
Now the installation of Net::SSH2 should be as simple as:
cpanm Net::SSH2
If you want to install the module system-wide, then you will need to prefix the cpanm call with sudo:
sudo cpanm Net::SSH2

ppm.bat install failed: Can't find any package that provides GD-Graph3d

Getting an exception while installing Perl package through below command. Running Perl 5.26 on Windows 10.
ppm install GD-Graph3d
ppm.bat install failed: Can't find any package that provides GD-Graph3d
The ActiveState build for GD::Graph3d fails since Perl 5.24. See also the patch that ActiveState try to apply. Maybe you can install the module by using the cpan tool instead?
cpan GD::Graph3d

Need help for installing LDAP in unix

I am following the below procedure for installing LDAP in unix
1.tar -xzf perl-ldap-0.43.tar.gz
2.cd perl-ldap-0.43
3.perl MakeFile.PL
I am getting below message
* Checking for Perl dependencies...
We have to reconfigure CPAN.pm due to following uninitialized parameters:
cpan_home, keep_source_where, build_dir, build_cache, scan_cache, index_expire, gzip, tar, unzip, make, pager, makepl_arg, make_arg, make_install_arg, urllist, inhibit_startup_message, ftp_proxy, http_proxy, no_proxy, prerequisites_policy, cache_metadata
CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.
If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)
Are you ready for manual configuration? [yes]
How to install without CPAN and what are the dependent modules required to install Ldap?
Can anyone suggest me the standard process of installation.
Thanks In Advance
I assume that by perl-ldap-0.43.tar.gz you are trying to install Net::LDAP
How to install without CPAN?
CPAN is the recommended way of installing Perl modules. You have to configure it just once, after that if you need to install any Perl module you can just type the below.
$ cpan ModuleName like in your case instead of downloading, untaring and running makefile you can just do:
$ cpan Net::LDAP
What are the dependent modules required to install Ldap?
One more advantage of using CPAN is you don't have to care about dependencies. CPAN will install dependencies automatically if you ask it to do so. Do it by
$ perl -MCPAN -e shell
cpan[1]> o conf prerequisites_policy follow
cpan[2]> o conf commit
exit
Or just use App::cpanminus and run
$ cpanm Net::LDAP it will install the module with all its dependencies.
Also check out Perl LDAP page.
Edit: Based on your answer
You will get some errors like above, you will have to see the error log, check the Module which is missing, then go to CPAN and download that module's tar.gz and then do the same steps as you were doing, like untaring, and running Makefile. You will have to do this unless all of your dependencies are installed.
Can we ignore warnings while installing perl modules?
I have installed ExtUtils-MakeMaker-6.98.tar.gz by ignoring below warnings
Using included version of ExtUtils::Install (1.54) as it is newer than the installed version (1.33).
Using included version of CPAN::Meta::YAML (0.008) because it is not already installed.
Using included version of JSON::PP::Compat5006 (1.09) because it is not already installed.
Using included version of ExtUtils::Manifest (1.60) as it is newer than the installed version (1.46).
Using included version of version (0.88) because it is not already installed.
Using included version of ExtUtils::Command (1.16) as it is newer than the installed version (1.09).
Using included version of CPAN::Meta (2.120351) because it is not already installed.
Using included version of JSON::PP (2.27203) because it is not already installed.
Using included version of File::Temp (0.22) as it is newer than the installed version (0.16).
Using included version of Parse::CPAN::Meta (1.4405) because it is not already installed.
Using included version of File::Copy::Recursive (0.38) because it is not already installed.
Checking if your kit is complete...
Warning: the following files are missing in your kit:
't/liblist/win32/di
't/liblist/win32/space
Please inform the author.
Generating a Unix-style Makefile
Writing Makefile for ExtUtils::MakeMaker
Writing MYMETA.yml and MYMETA.json**
But I'm able to install successfully. Will it create any problems in future?

Perl DBD::Oracle Module installation

Could someone guide me how to install the Perl DBD::Oracle module?
Here is what I have done so far:
Platform: RHEL 5.8 64 bit
Installed Perl DBI package
Installed Oracle Instant client for Linux 64 bit (basi + sdk + sqlplus component for the instant client
Have set the correct $ORACLE_HOME and $LD_LIBRARY_PATH
Then when I do perl Makefile.pl it fails with the following error:
I'm having trouble finding your Oracle version number... trying harder
WARNING: I could not determine Oracle client version so I'll just
default to version 8.0.0.0. Some features of DBD::Oracle may not work.
Oracle version based logic in Makefile.PL may produce erroneous results.
You can use "perl Makefile.PL -V X.Y.Z" to specify a your client version.
Oracle version 8.0.0.0 (8.0)
DBD::Oracle no longer supports Oracle client versions before 9.2
Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.PL line 271.
The instant client version: 11.1.0
The DBD::Oracle version is 1.44
If you have installed successfully with the Oracle instant client, then could you please let me know what am I missing?
Is it possible to install DBD::Oracle without using the Oracle instant client?
Install if missing ExtUtils-MakeMaker module (sudo yum install perl-ExtUtils-MakeMaker)
Install Perl DBI module ($ yum install perl-DBI)
Manually install below three RPMs for Oracle instant client (from Instant Client Downloads for Linux x86-64. The example is for v11.2.0.3.0-1: adapt the commands below to the actual version.)
oracle-instantclient11.2-basic-11.2.0.3.0-1
oracle-instantclient11.2-devel-11.2.0.3.0-1
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
I am using 64 bit Linux box, so select your RPM filenames accordingly. Something like sudo yum -y install oracle-instantclient*rpm should do)
set below variables:
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
MacOS users will need:
DYLD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/
Also add ORACLE_HOME to your PATH variable.
download DBD::Oracle from CPAN
untar the module and run below commands in given sequence:
perl Makefile.PL
make
sudo make install
In case you get complaints about missing gcc you can (temporarily) install it and then remove it.
DONE !!!
Issues I had faced were due to the wrong LD_LIBRARY_PATH. I had set it to /usr/lib/oracle/11.2/client64 whereas the correct value is /usr/lib/oracle/11.2/client64/lib.
Certainly, this was a great learning for a newbie like me.
you can also read my article How to install DBD::Oracle which contains all the steps required to install DBD::Oracle CPAN module, which is not a straightforward installation. The purpose is to reduce headache and turn it into a repeatable process.
Here's what I did on CentOS 7.2 using yum packages and CPAN. This assumes you're using Oracle version 12.1 but I would imagine most versions will work this way.
Install Oracle Instant Client
yum install oracle-instantclient12.1-basic-12.1.0.2.0-1 oracle-instantclient12.1-devel-12.1.0.2.0-1 oracle-instantclient12.1-sqlplus-12.1.0.2.0-1
Copy demo make files
The install expects the *.mk file to be in /usr/share/oracle/12.1/client64 but the yum package install puts them in /usr/share/oracle/12.1/client64/demo.
sudo cp /usr/share/oracle/12.1/client64/demo/* /usr/share/oracle/12.1/client64
Modify .bashrc
Add the following lines to your ~/.bashrc
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export PATH=$ORACLE_HOME:$PATH
Now source the file
source ~/.bashrc
Update CPAN and DBI
Update CPAN and DBI to the latest
cpan> install CPAN
cpan> reload cpan
cpan> install DBI
Install DBD::Oracle
cpan> install DBD::Oracle
A little addition to slayedbylucifer answer. I had the same problem like mentioned in the question. I've done all the steps described by slayedbylucifer. But still I got the problem like mentioned here:
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /opt/oracle/app/oracle/product/11.2.0/client_1/lib//libclntsh.so when searching for -lclntsh
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lclntsh
So I created the following symbolic link:
ln -s /opt/oracle/app/oracle/product/<YOUR_ORACLE_VERSION>/client_1/lib/libclntsh.so $ORACLE_HOME/libclntsh.so*
After that step the error from above (cannot find -lclntsh) was fixed. The execution of the make command was without any errors.
The only problem I still have is that I don't understand why this symbolic link is necessary.

How to install GD library with Strawberry Perl

I am attempting to install the GD library using Strawberry perl and GnuWin32. However, when I enter "install GD" in the CPAN shell, the following message appears:
'gdlib-config' is not recognized as an internal or external command, operable program or batch file. **UNRECOVERABLE ERROR** Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
I believe perl is having difficulty locating the GD library installed at C:\Program Files\GnuWin32\bin, but I am not sure how to fix this. I am still new to perl, so any help would be appreciated.
Your error is confirmed on cpan testers.
Looks like you need to manually compile and install gdlib.
If you make sure that C:\Program Files\GnuWin32\bin is in your PATH variable ($PATH? %PATH%? I'm not sure which one GnuWin32 uses) before you start CPAN, the installer should find the gdlib-config program and you will at least be able to get through that step of the installation.
Run 'Makefile.PL' manually. It will show you list of parameters. Try running it with parameter "-lib_gd_path".
GD may be included in Strawberry 5.10.1.0 beta. A good place to ask is irc://irc.perl.org/#win32 IRC channel.
Which version of Strawberry Perl are you using? I am using the one bundled with Padre and GD came with it:
C:\opt> perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread
uname='Win32 padre 5.10.0.7.beta_1 #1 20 i386'
...
And:
C:\opt> perl -MGD -Mfeature=say -e "say $GD::VERSION"
2.44