This is a quick nagios plugin / script to query an ESXi server and grab the "overall status" parameter. This is a parameter each host should respond to and will reflect if any alarms are active on the system. See the official documentation for more info.
This should give notice in the event of a power supply failure, memory errors, loss of connectivity to datastore, etc.
The script only requires a Hostname, but allows for the providing of both a hostname and IP address. The hostname is required to make sure that the status being returned is for the correct host (I don't trust CIM to always return the hosts inside the "hostFolder" in the same order). It is actually used to query the API for the provided string, so it must be accurate and reflect what the system thinks its hostname is. Our environment and conditions mandated this. YMMV.