Twitter Updates

rynardtspies: @Twickersmatt Just getting to grips with the products. Will give you a shout if we get stuck. Thanks! 21 hours ago from TweetDeck in reply to Twickersmatt

Read more...



Script to Report ESX Snapshots PDF Print E-mail
User Rating: / 6
PoorBest 

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

Comments (9)
  • Anonymous

    download likn resulted with:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@virtualvcp.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  • Vicky  - Script to Report ESX Snapshots

    Hi, Rynardt

    The script reportsnapshots.pl is not available to download.

    Please provide me different link.

    Regards

    Vicky

  • Rynardt Spies  - Fixed the download issue

    Hi,

    It seems like the new web server was trying to parse the .pl file rather than download it to the browser. I don't have time to fix the Apache configuration at the moment.

    Instead I have renamed the reportsnapshot.pl file to reportsnapshots.txt and updated the download link.

    Please remember to rename the file back to reportsnapshots.pl once downloaded.

    Let me know if you have any further issues.

    Kind regards

    Rynardt Spies

  • Vicky  - How to verify that script is working or not

    Hi Rynardt,

    I add this script on one of my ESX server and also define the cronjob with below parameter.

    30 14 * * 1-5 /usr/local/bin/reportsnapshots.pl

    But I didn't got any mail..

    Please tell me how can i check the logs for the failure of script.
    Regards
    Vicky

  • Rynardt Spies  - How to verify that script is working or not

    Just a few things:

    Make sure all the relevant information (i.e. email address, mail server, etc.) has been entered into the script.

    Also make sure your ESX firewall is allowing outbound port 25. The script can open and close the firewall for you but that functionality is disabled in the script by default.

    Also make sure your email server doesn't require SMTP Authentication.

    Also, try running the script manually first before trying to get CRON to work.

    Let me know how you get on.

    Regards

    Rynardt

  • dell akku  - xps m1330 akku

    Hi, Rynardt

    The script reportsnapshots.pl is not available to download.

    Please provide me different link.

    Regards

    Vicky

  • Anonymous

    Will this work on ESX 5.0 ?

  • Anonymous  - -sh: reportsnapshots.pl: not found

    I got this error?
    -sh: reportsnapshots.pl: not found

  • Rynardt Spies  - RE: sh: reportsnapshots.pl: not found

    Hi,

    On what host are you trying to run the report? ESX or ESXi?

    If it's on ESX 3/4 make sure you follow my installation instructions above. If it's ESXi, then I'm afriad it's not going to work, as Perl is not bundled with ESXi. In that case you will have to use PowerCLI.

    Regards

    Regards

Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0