VMware ESX healthcheck
Filed under: Scripting, VMware
One of the most useful scripts for ESX in my opinion is health_check.sh. This scripts generates an html file which contains a enormous amount of useful info on how the ESX host was installed. Besides that it contains 30 lines of the most important log files and for instance if there are snapshots and much much more. I just tested the script on ESX 3.5 and it still works great. The script is created by two guys of the Danish VMUG one of them is A. Mikkelsen, check his blog for more scripts! Be sure to check out this script, it’s worth it! By the way, you can schedule it and have the html emailed to you via the use of smtp_send.pl.




January 28th, 2008 at 14:01
Hi,
And thanks very much for the nice comment.
If anyone have feature requests to the script please let me know.
A. Mikkelsen
January 28th, 2008 at 17:47
Yes, VERY useful script. I have tested it on ESX 3.0.x and also ESX 3.5 and is working great.
I did have problem setting it up in crontab. Have tried various settings but when I put it in crontab nothing happens. In crontab log it seams that script executed but no file is creater / mail send. Any ideas?
Thanx
January 28th, 2008 at 18:44
that’s because the path to the config file is missing. edit the script and put the config path in there the hard way.
January 28th, 2008 at 20:28
Great looking script. Would be nice to see if it could dump it to a csv. Have not looked to see if it can do that yet, but it would be very nice as I manage over 400 ESX servers right now. It would be nice it have it dump a csv on a scheduled basis. That way I could pull it up in a central report view.
January 28th, 2008 at 20:42
Doesn’t support csv at the moment… But just request the feature on the forum of sourceforge and maybe, if these guys can find the time, they will hook you up.
January 28th, 2008 at 21:29
Just put it in there!
Thanks!
January 29th, 2008 at 23:06
Just ran on two servers within our ESX farm. One running 3.5 and the other running 3.0.2. Both worked great! Going to work on getting it scheduled daily.
January 30th, 2008 at 14:00
“Duncan Epping
January 28th, 2008 at 18:44
that’s because the path to the config file is missing. edit the script and put the config path in there the hard way.”
Yes, you are right. After hardcode .conf file the script runs perfectly in crontab.
The only problem is now that it dont send emails. Probably enviroment problem?
January 30th, 2008 at 20:11
probably the same issue? hard coded path?
January 30th, 2008 at 21:48
I am having no problem getting the html generated but the email part is not working…I get the following:
smartHost: smtp.intra.net
to: gballard@dcolighting.com
subject: ESX Healthcheck VM1.intra.net
attach: /var/log/esx_healthcheck_30-01-08.html
Failed to connect to mail server: Invalid argument
at /health/smtp_send.pl line 114
And line 114 in the smtp_send.pl is:
$msg->send;
Any ideas?
January 30th, 2008 at 21:52
Did you open up port 25 on the ESX firewall?
January 30th, 2008 at 22:07
According to esxcfg-firewall -q:
Opened ports:
smtp_out : port 25 tcp.out
Yes it appears that it is open.
February 2nd, 2008 at 11:25
“Duncan Epping
January 30th, 2008 at 20:11
probably the same issue? hard coded path?”
Correct, I had to hardcode path also for smtp_send.pl and now is working
Thank you for your help!
February 3rd, 2008 at 18:49
Regarding the script to generate csv files instead of html i will look into this asap, but my test enviroment has crached and i’m waiting for a new disk.
I hope to get it within days and then i look into it.
Hope you can wait
February 4th, 2008 at 22:18
Got my test enviroment up and running.
I looked a bit on how to generate a CSV file and i need some idears.
1. Do you want 2 colums (description, data)?
Or give me an idear to how you would like it to look.
You can email it to me at (am”’_@_ ”’ amikkelsen.com)
2. Do you want a header/title for each colum?
Any idears are welcome - any code are also apprecited
March 3rd, 2008 at 17:16
Just another ‘attaboy’ for the script. I too hardcoded the paths for health_check.conf in the sh
. /usr/local/bin/health_check.conf
and
for smtp_send.pl in the conf
/usr/local/bin/smtp_send.pl
and it is working great as a cron job
thanks!!