VMware Cloud Community
Herschelle
Enthusiast
Enthusiast

hostops.pl No host found.

Whilst building a new ESXi installed host and applying the update bundles via vihostupdate to bring the server up to Build 236512, that all works just fine.

Now when I try to bring the host out of maintenance mode using the hostops.pl script the following occurs.

C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\host>hostops.pl --username root --password password --operation exit_maintenance --url https://10.248.6.250/sdk/vimService.wsdl --target_host 10.248.6.250
No host found.

This is the first time I have attempted to use the hostops.pl script. I have looked through the help etc to no avail.

I found the following post http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=101319... and I appear to be doing what it suggests.

The host is up as I can open a VI Client session to the host, and was able successfully do the vihostupdates without a problem.

Am I missing something?

Using vSphere CLI 4.0.0.1231 Build 198790 on Windows XP Professional.

0 Kudos
10 Replies
lamw
Community Manager
Community Manager

Generally, hostops is used in-conjunction with a vCenter server, hence you'll notice there is an extra param called target_host.

Though, it should work if you connect directly to the ESX(i) host OR vCenter.

I don't know what patches you had to apply to bring your build up to 236512, but I was able to test this with an ESXi host that is running base U1:

apps/host/hostops.pl --server esxi4-2.primp-industries.com --operation exit_maintenance --target_host esxi4-2.primp-industries.com

Host 'esxi4-2.primp-industries.com' exited maintenance mode successfully

This was tested on vCLI running on vMA 4.0 but should work with the standard vCLI installation.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Herschelle
Enthusiast
Enthusiast

I applied the following two bundles to bring the Build version up:

ESXi400-200912001.zip

ESXi400-201002001.zip

I'll see if I have a server without the bundles already installed and see if I get the same result.

0 Kudos
Herschelle
Enthusiast
Enthusiast

Ok, I tried the same thing on a clean ESXi 4.0 U1 Build 208167 with the same result.

I downloaded and installed vMA 4.0.0-161993

Ran the same comand as you did and received the same result. "No Host Found."

Interestingly when I deliberately put in a wrong password, I get the following message: "Cannot complete login due to an incorrect user name or password."

So it does seem to be contacting the server and authenticating, something past that point doesn't seem to work though.

The one thing I will say is that these esx servers are currently using DHCP and does not have DNS entries.

So I used an existing configured IP/DNS record, currently unused, for the server (don't ask) and the command works just fine. So this is what I found:

These do not work:

hostops.pl --target_host <ESX IP> --username root --password password --server <ESX IP> --operation exit_maintenance
hostops.pl --target_host <ESX IP> --username root --password password --server <ESX FQDN> --operation exit_maintenance

These work:

hostops.pl --target_host <ESX FQDN> --username root --password password --server <ESX IP> --operation exit_maintenance
hostops.pl --target_host <ESX FQDN> --username root --password password --server <ESX FQDN> --operation exit_maintenance

Not being a perl expert I can not tell what \ where in the script, needs then FQDN or if it is a bug. Howerver I guess that is my answer for now.

Thanks for your assistance William.

0 Kudos
lamw
Community Manager
Community Manager

My guess is that the param input for --target_host might be relying on FQDN, though I'm still not sure. I haven't ran into this issue before, but then again I don't really use hostops since there are a few bugs. I ended up writing my own if I needed anything extra/etc.

Can you give this version a try: and let me know if it works as expected or if you still run into this issue.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
QuietLeni
Contributor
Contributor

I also had the same problem - identical command line and "No host found." answer.

I realised that the name of the ESXi server in question was in uppercase on the console. When I changed it to be lowercase, the script started to work!

Hurrah!

Just thought that this might help someone else!

Regards,

QuietLeni

0 Kudos
Gids
Contributor
Contributor

Hi QuietLeni, thanks for that tip I've been scratching my head for a while with the host not found error, however I now get the following error:

SOAP Fault:

-


Fault string: fault.RestrictedVersion.summary

Fault detail: RestrictedVersionFault

Any ideas?

Setup is ESXi 4.0.0, 208167

VI Perl Toolkit version: 4.0

Script 'hostops.pl' version: 1.0

0 Kudos
lamw
Community Manager
Community Manager

The free ESXi license is not supported with any of the VMware CLI/SDK/APIs, you need to be using a paid license to utilize this specific feature.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
Gids
Contributor
Contributor

Thanks lamw, I wasn't aware there was a paid for version of ESXi?

Is there no other way to remotely shutdown an ESXi server

0 Kudos
lamw
Community Manager
Community Manager

Yes, there is the "free" version and then there are the "other" paid versions as listed out here - http://www.vmware.com/products/vsphere/buy/editions_comparison.html

There are a few things that you cant do with the free version, one of which is to perform r/w operations using the vSphere API, to utilize this specific feature, you just need to have a paid license, any of the ones above will work.

Regarding "remotely" shutting down a host, do a search on the forums, there are other non-supported methods that'll allow you to do a remote shutdown via SSH to the unsupported Busybox console

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
Gids
Contributor
Contributor

OK thanks lamw, unfortunately my current client is very small with only 2 vms running on the ESXi server. Making the move to the paid version would be cost prohibitive in this particular case.

I will have to investigate the unsupported methods

Cheers

0 Kudos