As network engineers and technicians, we often rely on Wireshark to troubleshoot and analyze network…
CloudStack/CloudPlatform create Snapshot policy for each root disk
Hey there,
people on hosted platforms don’t like if they try to logon and fail as the system screwed up for whatever reason.
Apache CloudStack/Accelerite CloudPlatform offers you to create a snapshot policy for each disk on a given date for fast recovery.
Disclaimer: a separate Backup process is still recommended!
The issue is that it’s really per each disk and not a global option. When hosting hundreds of instances, the UI is not really an option.
Here a quick and dirty script for creating snapshotpolicies on all rootdisks as a quick google search did not offer the right results (yes, I’m a bit surprised too)
Requirements:
– CloudStack/CloudPlatform of course 😉
– CloudMonkey
– A secondary storage large enough to hold all snapshots
The script does create a weekly snapshot policy for all rootdisks on Sunday morning, 4AM german local time with a retention of 3
Please consult the CloudStack API to modify it to your needs.
rootids=`cloudmonkey list volumes type=Root filter=id listall=true | grep ^id\ | awk '{ print $3 }'` for disk_id in $rootids; do snapshotid=`cloudmonkey create snapshotpolicy intervaltype=WEEKLY maxsnaps=3 schedule=00:4:1 timezone=Europe/Berlin volumeid=$disk_id` echo "############################################" echo "Added snapshotpolicy for " $snapshotid done;