Page 1 of 1

check_vmware_api.pl problems after reinstall

Posted: Wed Feb 23, 2022 6:58 pm
by gormank
Hi,
We had a bit of a disaster and had to reinstall the OS and Nagios XI, then restored the same NXI version.
After installing the vmware perl SDK, I get the following when running a check for any VMs.
Any suggestions n figuring out the issue and resolving it?

root# /home/gormke1/check_vmware_api.pl -H solktxeshgw-h-smeesxb-01.platform.vzgw -u [email protected] -p xxxx --command=cpu --subcommand=usage -w 50% -c 80% -D solktxeshgw-v-svevwvc-01 -C BackEnd --timeout=15

CHECK_VMWARE_API.PL UNKNOWN - Error connecting to server at 'https://solktxeshgw-v-svevwvc-01:443/sdk/webService': Bad hostname

The VM and datastore hostnames are resolvable.
# nslookup solktxeshgw-v-svevwvc-01

Name: solktxeshgw-v-svevwvc-01.platform.vzgw
Address: 2001:4888:a03:3196:c0:180:0:401

Re: check_vmware_api.pl problems after reinstall

Posted: Thu Feb 24, 2022 12:51 pm
by gormank
When installing the SDK the bundled modules were used. I had an error on Socket6.so perl_gather_something I seem to recall and renamed the one referenced in the error. Renaming the lib causes perl to use another Socket6.so

Here's the original error:
# /usr/local/nagios/libexec/check_vmware_api.pl -H solktxeshgw-h-smeesxb-01.platform.vzgw -u [email protected] -p 5t6y%T^Ygrid --command=cpu --subcommand=usage -w 50% -c 80% -D solktxeshgw-v-svevwvc-01.platform.vzgw -C BackEnd --timeout=15
/usr/bin/perl: symbol lookup error: /usr/lib64/perl5/auto/Socket6/Socket6.so: undefined symbol: Perl_Gthr_key_ptr

When installing using CPAN, CPAN tries to use http even though urllist has https.

# grep urllist .cpan/CPAN/MyConfig.pm
'urllist' => [q[https://www.perl.org/CPAN/]],

My guess is that the check script is somehow not handling the datastore server properly.

I also tried a more generic script from the SDK w/ a similar result.

/usr/lib/vmware-vcli/apps/host/hostinfo.pl --username [email protected] --password 'xxx' --url http://solktxeshgw-v-svevwvc-01.platfor ... webService --datacenter Texas
Error connecting to server at 'https://solktxeshgw-v-svevwvc-01.platform.vzgw/sdk': Bad hostname

Re: check_vmware_api.pl problems after reinstall

Posted: Thu Feb 24, 2022 5:28 pm
by ssax
What version of the VMware SDK did you install?

SSH into the XI server and send the full output of these commands:

Code: Select all

- Change X.X.X.X, yourusername, yourpassword before running

Code: Select all

/usr/local/nagios/libexec/check_vmware_api.pl -H X.X.X.X -u 'yourusername' -p 'yourpassword'  -l "CPU" -vvv --trace=4
uname -a
cat /etc/*release
nslookup solktxeshgw-h-smeesxb-01.platform.vzgw
curl -k -L -vvv 'https://solktxeshgw-h-smeesxb-01.platform.vzgw/sdk/'
env
su -s /bin/bash -c '/bin/env' nagios
Replace X.X.X.X with the VCenter/ESXI IP address and fill in a valid username and password in the commands below:

SSH into the XI server, and change to the following directory:

Code: Select all

cd /usr/lib/vmware-vcli/apps/general
Run this to test to see if you can connect to the VCenter/ESXI server:
- Change X.X.X.X, yourusername, yourpassword before running

Code: Select all

./connect.pl --server X.X.X.X --username 'yourusername' --password 'yourpassword' --verbose

Re: check_vmware_api.pl problems after reinstall

Posted: Tue Mar 01, 2022 3:45 pm
by gormank
Hi,
The SDK is 6.5 since there's a post on the forum or the KB saying 6.7 is bad.
BTW, this used to work on this system and is working in five other envs with ESX hosts.
We go through the vcenter host for checks and ask it about the status of ESX hosts. The nagios user doesn't exist in the ESX hosts as far as I know. Here are both commands.

# /usr/local/nagios/libexec/check_vmware_api.pl -H solktxeshgw-h-smeesxb-01.platform.vzgw -u [email protected] -p 5t6y%T^Ygrid -l cpu -vvv --trace=4
[extra-opts] check_vmware_api.pl -H solktxeshgw-h-smeesxb-01.platform.vzgw -u [email protected] -p 5t6y%T^Ygrid -l cpu -vvv --trace=4
CHECK_VMWARE_API.PL UNKNOWN - Error connecting to server at 'https://solktxeshgw-h-smeesxb-01.platfo ... webService': Bad hostname


# /usr/local/nagios/libexec/check_vmware_api.pl -H solktxeshgw-h-smeesxb-01.platform.vzgw -u [email protected] -p 5t6y%T^Ygrid --command=cpu --subcommand=usage -w 50% -c 80% -D solktxeshgw-v-svevwvc-01.platform.vzgw -C Texas --timeout=15 -vvv --trace=4
[extra-opts] check_vmware_api.pl -H solktxeshgw-h-smeesxb-01.platform.vzgw -u [email protected] -p 5t6y%T^Ygrid --command=cpu --subcommand=usage -w 50% -c 80% -D solktxeshgw-v-svevwvc-01.platform.vzgw -C Texas --timeout=15 -vvv --trace=4
CHECK_VMWARE_API.PL UNKNOWN - Error connecting to server at 'https://solktxeshgw-v-svevwvc-01.platfo ... webService': Bad hostname

# uname -a
Linux solktxeshgw-v-sienags-01.platform.vzgw 3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 9 16:09:48 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"
Red Hat Enterprise Linux Server release 7.9 (Maipo)
Red Hat Enterprise Linux Server release 7.9 (Maipo)

# nslookup solktxeshgw-h-smeesxb-01.platform.vzgw
Server: 2001:4888:a03:3197:c0:180:0:101
Address: 2001:4888:a03:3197:c0:180:0:101#53

Name: solktxeshgw-h-smeesxb-01.platform.vzgw
Address: 2001:4888:a03:3191:c0:180:0:101

# nslookup solktxeshgw-v-svevwvc-01.platform.vzgw
Server: 2001:4888:a03:3197:c0:180:0:101
Address: 2001:4888:a03:3197:c0:180:0:101#53

Name: solktxeshgw-v-svevwvc-01.platform.vzgw
Address: 2001:4888:a03:3196:c0:180:0:401

# curl -k -L -vvv 'https://solktxeshgw-h-smeesxb-01.platform.vzgw/sdk/'
* About to connect() to solktxeshgw-h-smeesxb-01.platform.vzgw port 443 (#0)
* Trying 2001:4888:a03:3191:c0:180:0:101...
* Connected to solktxeshgw-h-smeesxb-01.platform.vzgw (2001:4888:a03:3191:c0:180:0:101) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: C=US,ST=Texas,L=Houston,OU=ISS,O=Hewlett Packard Enterprise,CN=ILOMXQ64506R0
* start date: Nov 13 10:31:13 2016 GMT
* expire date: Nov 13 10:31:13 2031 GMT
* common name: ILOMXQ64506R0
* issuer: C=US,ST=Texas,L=Houston,OU=ISS,O=Hewlett Packard Enterprise,CN=Default Issuer (Do not trust)
> GET /sdk/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: solktxeshgw-h-smeesxb-01.platform.vzgw
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/html
< Date: Mon, 28 Feb 2022 18:55:45 GMT
< X-Content-Type-Options: nosniff
< X-Frame-Options: sameorigin
< X-XSS-Protection: 1; mode=block
< Content-Length: 0
<
* Connection #0 to host solktxeshgw-h-smeesxb-01.platform.vzgw left intact


# env
XDG_SESSION_ID=163101
HOSTNAME=solktxeshgw-v-sienags-01.platform.vzgw
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
SUDO_USER=gormke1
SUDO_UID=404000020
USERNAME=root
PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin
MAIL=/var/spool/mail/root
PWD=/usr/lib/vmware-vcli/apps/general
LANG=en_US.UTF-8
HISTCONTROL=ignoredups
SHLVL=1
SUDO_COMMAND=/bin/bash
HOME=/root
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
SUDO_GID=404000020
_=/bin/env
OLDPWD=/root

# su -s /bin/bash -c '/bin/env' nagios
XDG_SESSION_ID=163101
HOSTNAME=solktxeshgw-v-sienags-01.platform.vzgw
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
USER=nagios
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
SUDO_USER=gormke1
SUDO_UID=404000020
USERNAME=root
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin
_=/bin/env
PWD=/usr/lib/vmware-vcli/apps/general
LANG=en_US.UTF-8
HISTCONTROL=ignoredups
HOME=/home/nagios
SUDO_COMMAND=/bin/bash
SHLVL=2
LOGNAME=nagios
LESSOPEN=||/usr/bin/lesspipe.sh %s
SUDO_GID=404000020

general]# ./connect.pl --server 2001:4888:a03:3196:c0:180:0:401 --username '[email protected]' --password '5t6y%T^Ygrid' --verbose

Socket6 object version 0.29 does not match bootstrap parameter 0.23 at /usr/lib64/perl5/DynaLoader.pm line 213.
Compilation failed in require at /usr/lib64/perl5/IO/Socket/INET6.pm line 38.
BEGIN failed--compilation aborted at /usr/lib64/perl5/IO/Socket/INET6.pm line 38.
Compilation failed in require at /usr/lib64/perl5/Net/INET6Glue/INET_is_INET6.pm line 11.
BEGIN failed--compilation aborted at /usr/lib64/perl5/Net/INET6Glue/INET_is_INET6.pm line 11.
Compilation failed in require at /usr/share/perl5/VMware/VICommon.pm line 695.

I renamed the Socket6.so.org back to the right name and we go back to the original issue.

# mv /usr/lib64/perl5/auto/Socket6/Socket6.so.org /usr/lib64/perl5/auto/Socket6/Socket6.so
# cd /usr/lib/vmware-vcli/apps/general
general]# ./connect.pl --server 2001:4888:a03:3196:c0:180:0:401 --username '[email protected]' --password '5t6y%T^Ygrid' --verbose
Hiding the command line arguments: symbol lookup error: /usr/lib64/perl5/auto/Socket6/Socket6.so: undefined symbol: Perl_Gthr_key_ptr

Re: check_vmware_api.pl problems after reinstall

Posted: Fri Mar 04, 2022 10:26 am
by pbroste
Hello @gormank

Thanks for following up; I see that there is an Open support ticket, and you are currently working with Vihn on this; I will go ahead and close/lock this one up so you can work on resolving it.

Thanks,
Perry