Failed to add vCenter 6.5

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Failed to add vCenter 6.5

Post by hgs »

Hi all

I have a problem adding a vCenter server via the Configuration Wizard in Nagios XI. I can add a individual ESX host and see the guest running on them OK but adding the vCenter server i get the following error.

Error
It appears there are no guests for this VMware host. The error message is below. This may be because the SDK is not installed, your credentials are wrong, or the host is not a VMware server.
Can't call method "alternateGuestName" on an undefined value at /usr/local/nagiosxi/html/includes/configwizards/vmware/scripts/getguests.pl line 160.


the SDK has been installed and it works. if i deliberately use a wrong username and password i get the following error.

Error
It appears there are no guests for this VMware host. The error message is below. This may be because the SDK is not installed, your credentials are wrong, or the host is not a VMware server.
Error: Cannot complete login due to an incorrect user name or password.


i have 5 ESX 6.5 hosts with 1 vCenter Server Appliance.

any help will be great.

Thanks
Darran
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Failed to add vCenter 6.5

Post by scottwilkerson »

Does the vCenter account you are using have access to all the hosts/guests on the system?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Re: Failed to add vCenter 6.5

Post by hgs »

Thanks for the fast reply Scott.
I am using the [email protected] account to log into vCenter
i use root to log into the individual ESX hosts.
yes i can see the Cluster and the 5 hosts with all the VMs if i use the [email protected]

sorry for the delay in responding as i have been on holidays.
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Re: Failed to add vCenter 6.5

Post by hgs »

After further investigation i have found out that the ESX host 5 has the same error message when using the root username.
this may be why the vcenter fails
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Re: Failed to add vCenter 6.5

Post by hgs »

our ESX Host 05 appreas to be the problem. I have done a reboot of this host with no change to the issue
ESX host 05 failed.PNG
i have run the following command

Code: Select all

tail -f /var/log/httpd/error_log
got the following output

Code: Select all

[root@hgsnagprd01 scripts]# tail -f /var/log/httpd/error_log
[Thu Jun 22 13:11:20 2017] [error] [client 10.1.53.67] PHP Warning:  explode() expects parameter 2 to be string, array given in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3430, referer: http://nagios/nagiosxi/config/monitoringwizard.php?&=
[Thu Jun 22 13:11:20 2017] [error] [client 10.1.53.67] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3431, referer: http://nagios/nagiosxi/config/monitoringwizard.php?&=
[Thu Jun 22 13:11:41 2017] [error] [client 10.1.53.4] PHP Warning:  explode() expects parameter 2 to be string, array given in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3430, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:11:41 2017] [error] [client 10.1.53.4] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3431, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:12:19 2017] [error] [client 10.1.53.67] PHP Warning:  explode() expects parameter 2 to be string, array given in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3430, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:12:19 2017] [error] [client 10.1.53.67] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3431, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:14:21 2017] [error] [client 10.1.53.67] PHP Warning:  explode() expects parameter 2 to be string, array given in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3430, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:14:21 2017] [error] [client 10.1.53.67] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3431, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:14:42 2017] [error] [client 10.1.53.67] PHP Warning:  explode() expects parameter 2 to be string, array given in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3430, referer: http://nagios/nagiosxi/config/monitoringwizard.php
[Thu Jun 22 13:14:42 2017] [error] [client 10.1.53.67] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 3431, referer: http://nagios/nagiosxi/config/monitoringwizard.php
You do not have the required permissions to view the files attached to this post.
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Re: Failed to add vCenter 6.5

Post by hgs »

some information to help
I followed this link
https://assets.nagios.com/downloads/nag ... 1497518508
and downloaded the vSphere Perl SDK for vSphere 6.5 [4566394]
got no errors during the install
all ESX Host are at the same patch level
(Updated) ESXi-6.5.0-20170104001-standard

i have changed the permissions of the getguests.pl

Code: Select all

chmod 755 /usr/local/nagiosxi/html/includes/configwizards/vmware/scripts/getguests.pl
chmod 775.PNG

Code: Select all

[root@hgsnagprd01 scripts]# uname -a
Linux hgsnagprd01.highgate1.local 2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Apr 11 17:13:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Code: Select all

[root@hgsnagprd01 scripts]# cat /etc/*release
CentOS release 6.9 (Final)
CentOS release 6.9 (Final)
CentOS release 6.9 (Final)

Code: Select all

[root@hgsnagprd01 scripts]# yum list installed | grep perl
perl.x86_64                           4:5.10.1-144.el6                 @base
perl-CPAN.x86_64                      1.9402-144.el6                   @base
perl-Class-Accessor.noarch            0.31-6.1.el6                     @base
perl-Class-Singleton.noarch           1.4-6.el6                        @base
perl-Compress-Raw-Zlib.x86_64         1:2.021-144.el6                  @base
perl-Compress-Zlib.x86_64             2.021-144.el6                    @base
perl-Config-IniFiles.noarch           2.72-2.el6                       @epel
perl-Config-Tiny.noarch               2.12-7.1.el6                     @base
perl-Crypt-DES.x86_64                 2.05-9.el6                       @epel
perl-Crypt-Rijndael.x86_64            1.09-2.el6                       @epel
perl-Crypt-SSLeay.x86_64              0.57-17.el6                      @base
perl-DBD-MySQL.x86_64                 4.013-3.el6                      @base
perl-DBI.x86_64                       1.609-4.el6                      @base
perl-DateTime.x86_64                  1:0.5300-3.el6                   @base
perl-Digest-HMAC.noarch               1.01-22.el6                      @base
perl-Digest-SHA.x86_64                1:5.47-144.el6                   @base
perl-Digest-SHA1.x86_64               2.12-2.el6                       @base
perl-Error.noarch                     1:0.17015-4.el6                  @base
perl-ExtUtils-MakeMaker.x86_64        6.55-144.el6                     @base
perl-ExtUtils-ParseXS.x86_64          1:2.2003.0-144.el6               @base
perl-HTML-Parser.x86_64               3.64-2.el6                       @base
perl-HTML-Tagset.noarch               3.20-4.el6                       @base
perl-IO-Compress-Base.x86_64          2.021-144.el6                    @base
perl-IO-Compress-Zlib.x86_64          2.021-144.el6                    @base
perl-IO-Socket-INET6.noarch           2.56-4.el6                       @base
perl-IO-Socket-SSL.noarch             1.31-3.el6_8.2                   @base
perl-IO-stringy.noarch                2.110-10.1.el6                   @base
perl-List-MoreUtils.x86_64            0.22-10.el6                      @base
perl-Mail-IMAPClient.noarch           3.37-1.el6                       @epel
perl-Mail-POP3Client.noarch           2.18-6.el6                       @epel
perl-Math-Calc-Units.noarch           1.07-6.el6                       @epel
perl-Module-Pluggable.x86_64          1:3.90-144.el6                   @base
perl-Nagios-Plugin.noarch             0.35-1.el6                       @epel
perl-Net-DNS.x86_64                   0.65-5.el6                       @base
perl-Net-LibIDN.x86_64                0.12-3.el6                       @base
perl-Net-SMTP-TLS.noarch              0.12-1.el6.rf                    @nagiosxi-deps
perl-Net-SNMP.noarch                  5.2.0-4.el6                      @epel
perl-Net-SSLeay.x86_64                1.35-10.el6_8.1                  @base
perl-Number-Format.noarch             1.73-3.el6                       @epel
perl-Params-Validate.x86_64           0.92-3.el6                       @base
perl-Parse-RecDescent.noarch          1.965-1.el6                      @epel
perl-Pod-Escapes.x86_64               1:1.04-144.el6                   @base
perl-Pod-Simple.x86_64                1:3.13-144.el6                   @base
perl-SNMP_Session.noarch              1.12-4.el6                       @base
perl-Socket6.x86_64                   0.23-4.el6                       @base
perl-Test-Harness.x86_64              3.17-144.el6                     @base
perl-Test-Simple.x86_64               0.92-144.el6                     @base
perl-Time-HiRes.x86_64                4:1.9721-144.el6                 @base
perl-TimeDate.noarch                  1:1.16-13.el6                    @base
perl-URI.noarch                       1.40-2.el6                       @base
perl-XML-LibXML.x86_64                1:1.70-5.el6                     @base
perl-XML-NamespaceSupport.noarch      1.10-3.el6                       @base
perl-XML-Parser.x86_64                2.36-7.el6                       @base
perl-XML-SAX.noarch                   0.96-7.el6                       @base
perl-XML-Simple.noarch                2.18-6.el6                       @base
perl-devel.x86_64                     4:5.10.1-144.el6                 @base
perl-libs.x86_64                      4:5.10.1-144.el6                 @base
perl-libwww-perl.noarch               5.833-5.el6                      @base
perl-version.x86_64                   3:0.77-144.el6                   @base
rrdtool-perl.x86_64                   1.3.8-10.el6                     @base
[root@hgsnagprd01 scripts]#
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Failed to add vCenter 6.5

Post by tgriep »

Let's use the VMWare Perl SDK to see if you can connect to the VMWare servers and bypass using the plugin all together.
Login to the Nagios server as root when running the scripts. Post the output so we can view it.

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 VMWare VCenter server

Code: Select all

./connect.pl --url https://xxx.xxx.xxx.xxx/sdk/vimService --username <username> --password <password>
If the above passes, go to this directory.

Code: Select all

cd /usr/lib/vmware-vcli/apps/host
Run this to test to see if you can get the list of hosts connected to the VMWare VCenter server

Code: Select all

./hostinfo.pl --url https://xxx.xxx.xxx.xxx/sdk/vimService --username <username> --password <password>
If the above passes, go to this directory.

Code: Select all

cd /usr/lib/vmware-vcli/apps/vm
Displays the VM Guests running on the system

Code: Select all

./vminfo.pl --url https://xxx.xxx.xxx.xxx/sdk/vimService --username <username> --password <password>
Let us know how it works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Re: Failed to add vCenter 6.5

Post by hgs »

Yes that worked i can see all the Hosts and all the guests running on the hosts.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Failed to add vCenter 6.5

Post by tgriep »

I wonder if it is a compatibility issue with that version of the VMWare Perl SDK or that the getguests.pl script cannot find the modules it needs.
Can you login to the Nagios server, run the following and post the output?

Code: Select all

cd /html/includes/configwizards/vmware/scripts/
./getguests.pl -H xxx.xxx.xxx.xxx -u username -p password
Replace xxx.xxx.xxx.xxx with the IP address of the vcenter server.
Be sure to check out our Knowledgebase for helpful articles and solutions!
hgs
Posts: 11
Joined: Fri Jun 16, 2017 2:35 am

Re: Failed to add vCenter 6.5

Post by hgs »

this worked and i started to get a list of VMs.
it the stopped and has the following output

Code: Select all

Can't call method "alternateGuestName" on an undefined value at ./getguests.pl line 160.
%2fvmfs%2fvolumes%2f4d88896f-5d115575-5491-001b214ada48%2fHGSTS01%2fHGSTS01.vmx[root@hgsnagprd01 scripts]#
checking the ESX host and there is a inaccessible VM
ESX host.PNG
You do not have the required permissions to view the files attached to this post.
Locked