VMware {code} Community
dinny
Expert
Expert

Problem running the hostinfo.pl sample app

Hiya,

I finally managed to get the VM application downloaded and installed.

I'm just trying out some of the sample apps.

Using hostinfo.pl works for a while till it bombs out with:

Can't use an undefined value as an ARRAY reference at hostinfo.pl line 342[/i]

I'm using a parameter of:

--folder 'Hosts & Clusters'

As that's my top level folder - (and the only one I currently have set up in my VC).

Below that I have a couple of datacentres - one containing ESX 2.5 servers and one containing ESX 3.01 servers.

I suspect the script just caters for ESX 3.01 servers (as it works for a few ESX 3 servers - then stops part way through the first ESX 2.5 server that it tries to process) - which is fine.

All I want to know is how do I get it to access a folder just containing the ESX 3.01 servers.

I'm a real perl beginner - so haven't really tried to look at the code.

I presume I need to create a new folder above the ESX 3.01 datacentre and then point the script at that.

So I created a new folder "ESX301" and moved the ESX 3 datacentre in to it.

I then tried to point the script just at that folder:

--folder ESX301

No change - it still seemed to try and process the whole tree - including the ESX 2.5 servers.

I tried:

--folder 'Hosts & Clusters/ESX301'

and

--folder 'Hosts & Clusters\ESX301'

It just said:

Folder not found[/i]

What should I put in the --folder[/b] parameter for it to only process the folder containing my ESX301 servers?

Dinny

0 Kudos
10 Replies
dinny
Expert
Expert

Just read through my notes from the TSX lab - and remembered that most things in the perl toolkit referred to a somewhat meaningless name from the MOB.

Have browsed through the VC MOB a little and tried to use --folder xxxx where xxxx related to the value of the ESX301 folder or datacenter as specified in the MOB.

Got a "folder not found" message for all of these too....

Am I more on the right lines now?

Dinny

0 Kudos
dinny
Expert
Expert

Have had a quick look at the code.

I see that it ought to work with ESX 2.5 servers anyway.

Line 342 seems to be checking the filesystems.

I suspect as I have my vmfs 3 LUNs zoned to my ESX 2.5 servers - that may be why the script bombs out?

However I'm no nearer to getting the script to only access the ESX 3 datacenter.

I've noticed that there is a --datacenter option as well as a --folder option.

But I've tried various options of xxxx with the --datacenter xxxx option.

I either get a "not found" - or it carries on and still processes the ESX 2.5 servers anyway...

A totally separate thing I've noticed is that in the toolkit documentation - sometimes the --url is shown as:

https://server/sdk

and sometimes as

https://server/sdk/vimService

are these interchangeable - or is one correct and one incorrect?

Dinny

0 Kudos
SaranshG
Enthusiast
Enthusiast

Please look at the following scenarios

a. Finding out information about all hosts within a folder (Using the folder name)

1. In –folder parameter, specify just the name of the folder you want to browse (not the complete path) e.g. us ‘ESX301’ in place or 'Hosts & Clusters/ESX301'.

2. Value passed in –url parameter should always be the URL of the Virtual Center (not the host).

3. Pass the –username and –password corresponding to the url parameter.

b. Find out information about a specific host

1. –folder parameter is not required

2. In the –url parameter, pass the URL of the host.

3. Pass the –username and –password corresponding to the url parameter.

Also note that https://server/sdk or https://server/sdk/vimService can be used interchangeably, vimService in this context is a secure Web Service through which you access VI APIs. By default, these Web services run on port 443, as a secure Web service that can be accessed using SSL over HTTP (HTTPS), as in:

https://server/sdk

Refer Page 18 of Revised GettingStarted.pdf.

Hope this helps. Please let me know if you have any questions

0 Kudos
dinny
Expert
Expert

Hiya,

Thanks for the reply.

1. In –folder parameter, specify just the name of the

folder you want to browse (not the complete path)

e.g. us ‘ESX301’ in place or 'Hosts &

Clusters/ESX301'.

As above - that was what I tried to do - when I realised it traversed the whole VC env by default - I have tried again - it still seems to ignore the folder parameter and traverse the whole VC environment - including ESX 2.5 hosts not in the ESX301 folder.

I'm using a .visdkrc file to pass in the following variables for my user, pwd and VC server

VI_URL

VI_USERNAME

VI_PASSWORD

I know they are OK as it traverses quite a number of ESX 3 host in my VC env before failing.

The actual command I'm typing is:

perl hostinfo.pl --folder ESX301[/b]

So I guess it still leaves two questions:

1) Why is it ignoring the --folder parameter?

2) Why is it failing on my ESX 2.5 server(s) anyway?

Also note that https://server/sdk or

https://server/sdk/vimService can be used

interchangeably

That's what I suspected - thanks for confirming that.

Revised GettingStarted.pdf.

Where can I get hold of this pdf - it doesn't seem to be in the beta toolkit download?

Dinny

0 Kudos
kwiseth
Contributor
Contributor

Revised GettingStarted.pdf.

>>Where can I get hold of this pdf - it doesn't seem to be in the beta >>toolkit download?

The GettingStarted.pdf is not available at this time. Also, the GettingStarted.pdf is for VI SDK, not for VI Perl Toolkit.

However, the information that was being referred to was simply that:

The default protocol for accessing the Web service (port 443) of ESX Server or VirtualCenter Server systems is HTTPS. The servers can be configured to support HTTP (requires modification to the respective server's configuration file (vpxd.cfg for VirtualCenter Server; config.xml for ESX Server--see the VI3 Basic System Administration Guide for details).

The default URL for access to port 443 in either case is https://servername/sdk (or https://servername/sdk/vimService, as noted above).

I can't figure out how to point to the BSA (Basic System Administration) Guide, so here's the info, extracted below:

________________________________________________________

To change security settings for a Web proxy service

1 Log on to the service console as the root user.

2 Change directories to /etc/vmware/hostd/.

3 Use nano or another text editor to open the config.xml file and find the following XML segment:

0 Kudos
SaranshG
Enthusiast
Enthusiast

Dinny,

o Can you please send the hostinfo.pl and .visdkrc file that you are using along with the detailed Hierarchal structure of your Virtual Center, this will help us recreate the problem.

o Please refer to the Supported Documentation of hostinfo.pl. Under SUPPORTED PLATFORMS section it is mentioned that “This script works with VMware ESX Server 3.0 or later.” The script must be failing on your ESX 2.5 server(s) for this reason.

Saransh

0 Kudos
dinny
Expert
Expert

Hiya,

1) I don't think I can post screenshots to the forum?

Probably easisest to email you a screenshot of my VC config - showing the hierarchy I have?

If you PM me with an email address I could send it direct?

If so - I'll add attach the other two files to the email.

2) It certainly does - I guess I must have mis-read it - that's that explained then...

Dinny

0 Kudos
SaranshG
Enthusiast
Enthusiast

Dinny,

Got the hostinfo.pl you are using, its not the latest file available in VI Perl Toolkit Beta. Either you download the latest or just comment out code at line numbers 108 and 109 of your script to make it run fine.

Saransh

0 Kudos
SaranshG
Enthusiast
Enthusiast

Dinny,

Got the hostinfo.pl you are using, its not the latest file available in VI Perl Toolkit Beta. Either you download the latest or just comment out code at line numbers 108 and 109 of your script to make it run fine.

Saransh

0 Kudos
dinny
Expert
Expert

Hiya,

Sorry for the delay.....

Commenting out lines 108 and 109 worked perfectly.

Am now going to download beta 2 anyway...

Thanks v. much

Dinny

0 Kudos