When reading the VMTN forum I stumbled upon a topic about checking the VMFS for snapshots. Besides snaphunter by Xtravirt, which is an excellent script, there isn’t much out there. You can check the VirtualCenter database for snapshots but this way you would not notice the orphaned snapshots. (Orphaned snapshot occur when the vmsd file gets corrupted.) A couple of months before Xtravirt posted their script I wrote my own snapshot checking script named snapcheck.sh. You can easily schedule it via the crontab and if you have the MIME module in place and smtp_send.pl it will send an HTML email to you with a nice table, yellow line means a registered snapshot and red line means an orphaned snapshot. You should also have ssh key authentication in place, check for more info ssh key authentication the RTFM website. You can download the snapcheck script here! Enjoy it.
virtuel says
Thanks a lot for this post. I have been searching for something like this that could integrate directly into Virtual Center and notify groups when a scheduled snapshot is done/completed.
I however need a lot of help with this script. I am very new to the linux world and not sure what needs to be installed where. I have downloaded the necessary files as you have mentioned but how do I install the MIME package on the esx host? Also in an environment with multiple ESX hosts would I have to then install this on all my hosts or is there a way to run this from just one central location and be notified?
Thanks for all your help and sorry if the questions are basic
Duncan Epping says
just copy the Lite.pm file from the MIME package to the described folder in the blog article. You can unzip the package with winrar or something like that and you can use a tool like WINSCP for copying to ESX.
Jim Warren says
Thanks for the snapcheck.sh. I am using it now in place of snaphunter as a daily cron to monitor my vRanger snaps. I note that if I run the script ‘real-time’ I get the VMFS Volume usage stats however, if I run as a cron job, there isn’t any data? Thoughts?
Patrick Sobau says
I had a similar problem with one of my scriptss (checks only disk space via VDF -h).
When run as a cron you have to specify the path of vdf (/usr/sbin/vdf)
Have fun
ryno75 says
This is a nice script. I had to make a couple of mods to get it to work with ESX v4.0.0 Update1 due to changes in the vmware-cmd syntax. Apparently the “-q” option is no longer available??? No problem, just a little extra parsing…
Here are the changes I made:
42: VMNAME=`vmware-cmd -H ${esxhost}.${DNSDOMAIN} -U ${USER} -P ${PASSWORD} “$VMX” getconfig displayname | cut -d” ” -f 3-`
43: SNAP=`vmware-cmd -H ${esxhost}.${DNSDOMAIN} -U ${USER} -P ${PASSWORD} “$VMX” hassnapshot | cut -d” ” -f 3`
JamesC says
Has anyone managed to get this working with vSphere 4.1?