Oct/087
Track Datastore Free Space
I’ve got a great new script for you today!
We all love VMware for consolidating our servers. And we all know that virtualization requires lot’s of SAN space. But how do you keep track of the amount of space left on all your datastores? It’s pretty easy to create a report using the Powershell VI Toolkit. But who is going to read all those reports and compare them to yesterday’s values? You will most likely end up with a mailbox full of reports and still be surprized when yet another datastore fills up.
PeetersOnline to the rescue! How about storing the report every day and comparing today’s values to yesterday’s values? Then you can email yourself only the differences. The overview shows the datastores that changed since yesterday, the change rate and the current value. This way, you can easily assess if the datastore is about to fill up.
Because it is quite a large script (in Powershell terms) and it contains long lines that are not easily readable on my site, I have attached the script for you to download. It contains lot’s of comments, so you should be able to follow exactly what it does and how it works. If not, post a comment.
Enjoy!
Hugo
Track-Datastores (Rename to .ps1)
Related posts:
23:13 on November 13th, 2008
Good little tool, but it would also be great to export a CSV doc for reporting purposes.
just my $.02
Thanks
21:37 on September 29th, 2009
I want to export it to html to see it in my html reports????Please help
22:03 on January 21st, 2009
Hi
Cool script.
I have done some simular. This is a webpage that shows graphs.
http://www.amikkelsen.com/?p=118
Please give your comments
16:06 on March 30th, 2009
Hello Guys,
very nice script!
How can i add commands for sending me an alert if datastore capacity is for an example below 10% of complete storage?
Thanks in advance.
cheers
13:43 on August 13th, 2009
hello Hugo :)
many tnx for your help (how do manipule variable)
pls, i have an under gestion.
can i creat an exe file from the PS script file ?
(transportable)
tnx
arenas
14:38 on August 13th, 2009
That is currently not supported. Somebody is trying to build Portable Powershell. Search Google for it.
21:33 on September 29th, 2009
# Export the output to an xml file; the new Current file
$myColCurrent | Export-csv -Path “$Folder\$currentFile”
# Disconnect from Virtual Center
Disconnect-VIServer -Confirm:$False
# Finally, let’s compare the Current information to that in the Previous file
# Check if a Previous file exists
If (Test-Path “$Folder\$previousFile”)
{
# Import the Previous file
$myColPrevious = Import-Csv “$Folder\$previousFile”