16 Apr 2009

Script to Report ESX Snapshots

This script will report all ESX Virtual Machine snapshots found on the SAN via email.


Download reportsnapshots.txt (Right-click, Save As)

WARNING: DO NOT EDIT THIS SCRIPT WITH WINDOWS NOTEPAD OR WORDPAD. If you would like to edit this script in Windows, please use a editor like Win32Pad. Notepad or Wordpad will corrupt the file for Unix/Linux use!

Installation Steps:

  • Download the reportsnapshots.txt script from the link provided above. Once downloaded, rename the file to reportsnapshots.pl
  • Use Veeam FastSCP or WinSCP to copy the script to one of your ESX hosts. Copy the script to /usr/local/bin/reportsnapshots.pl
  • Log onto the ESX server. The next steps should be done with root permissions.
  • Use vi or nano to edit the script. Enter the following information in relevant lines on the script:
    • Email recipient addresses that will receive email alerts
    • The Fully Qualified Domain Name or IP address of your mail server
    • If you need the script to control the ESX firewall, uncomment the #open_firewall() and #close_firewall() lines.
    • The rest of the script should work with the defaults.
  • Save the file and exit the editor
  • Make the file an executable: chmod +x /usr/local/bin/reportsnapshots.pl


To run the script at a given time, schedule a cron job:

The cron daemon can execute commands at a given time like Windows Task Scheduler does.

The format for a crontab line is:

|----------------------------------|| Minute
|  |-------------------------------|| Hour
|  | |-----------------------------|| Day of Month
|  | |  |--------------------------|| Month of Year
|  | |  | |------------------------|| Day of Week(0 - 6) (SUNDAY = 0)
* * * * * command to execute

To execute the reportsnapshots.pl script at a given time (this one is at 3pm every Monday to Friday), do:

[root@esx1 root]# crontab -e

Add the following line to the crontab file

00 15 * * 1-5 /usr/local/bin/reportsnapshots.pl

Written by  0 comment
Last modified on Tuesday, 09 December 2014 16:41
Rate this item
(1 Vote)

Comments (0)

There are no comments posted here yet

Leave your comments

Posting comment as a guest. Sign up or login to your account.
0 Characters
Attachments (0 / 3)
Share Your Location

When you start writing GraphQL queries with filters off the top of your head without even looking at the reference… https://t.co/AbqVRGr4S3
Follow Rynardt Spies on Twitter