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.
Hi,
And thanks very much for the nice comment.
If anyone have feature requests to the script please let me know.
A. Mikkelsen
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
that’s because the path to the config file is missing. edit the script and put the config path in there the hard way.
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.
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.
Just put it in there!
Thanks!
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.
“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?
probably the same issue? hard coded path?
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?
Did you open up port 25 on the ESX firewall?
According to esxcfg-firewall -q:
Opened ports:
smtp_out : port 25 tcp.out
Yes it appears that it is open.
“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!
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 🙂
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
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!!
Thanks for a very helpful post AND blog!
Hi. Looks great, but why is there no development on the SF project?
Is there a ESXi compatible script?
//Daniel
Not yet, but the guys are working on it, they are probably going to leverage Powershell…
It Would have been nice to use VMware’s RCLI appliance
Thanks so much for this really useful script
This article achieved exatcly what I wanted it to achieve.
The script is great and had been running fine until I removed some datastores now it errors when running and doesn’t complete. Any idea what could be wrong?
[2009-08-11 09:53:45 ‘StorageInfo’ warning] Skipping lun: vmhba1:0:21. SysinfoEx ception: Node (VSI_NODE_storage_scsi_adapter_channel_target_lun_partition) ; Status(bad003f)= No connection; Message= Unable to Get Instance List
I’m having the same issue as MarkC. Anyone find an answer for this one? The new rev 49 does the same error spit.
[root@sunvh01 healthchk]# /usr/local/bin/healthchk/health_check.sh
: bad interpreter: No such file or directory.sh: /bin/sh
[root@sunvh01 healthchk]# sh /usr/local/bin/healthchk/health_check.sh
: command not foundthchk/health_check.sh: line 20:
: No such file or directoryalth_check.sh: line 21: cd: /usr/local/bin/healthchk
: command not foundthchk/health_check.sh: line 26:
: command not foundthchk/health_check.sh: line 35:
: command not foundthchk/health_check.sh: line 39:
: command not foundthchk/health_check.sh: line 44:
rm: cannot lstat `/var/log/*.html\r’: No such file or directory
: command not foundthchk/health_check.sh: line 46:
: command not foundthchk/health_check.sh: line 48:
/usr/local/bin/healthchk/health_check.sh: line 49: syntax error near unexpected ‘oken `{
‘usr/local/bin/healthchk/health_check.sh: line 49: `printhtmlstart() {
hi,
to over come this issue,
[root@sunvh01 healthchk]# /usr/local/bin/healthchk/health_check.sh
: bad interpreter: No such file or directory.sh: /bin/sh
please try this.
simple Perl command always seems to clear up the problem. Try the following command on your text file then try and run it.
perl -i -pe’s/\r$//;’
is “health_check.sh” please try without quotes.