Home > Command Line > Catalog Virtual Machines

Catalog Virtual Machines

January 20th, 2009

This script is useful if you want to keep an eye on new machines. I had a customer that couldn’t keep track of who was creating machines and the datastores filling up all the time. You don’t want full datastores!!!

[root@esx007 root]# cat catalog_servers.sh
#!/bin/sh

date > /root/catalog_servers.txt
echo ——————– >> /root/catalog_servers.txt
echo Virtualised Servers and Datastores >> /root/catalog_servers.txt
echo ——————– >> /root/catalog_servers.txt
ls -1F /vmfs/volumes/ | grep @ | cut -d @ -f 1 | while read dir; do
 find /vmfs/volumes/${dir}/ -name “*.vmx” | grep -v “.snapshot” | cut -c 15-100 | cut -d / -f 1,2 >> /root/catalog_servers.txt
done
echo ——————– >> /root/catalog_servers.txt
echo “Free Space | Percentage Free | Volume” >> /root/catalog_servers.txt
echo ——————– >> /root/catalog_servers.txt
/usr/sbin/vdf -h | grep volumes | grep -v local | grep -v “-” | cut -c 34-40,41-44,59-100 >> /root/catalog_servers.txt

Command Line ,

  1. No comments yet.
  1. No trackbacks yet.



This site is not affiliated or sponsored in anyway by NetApp or any other company mentioned within.
%d bloggers like this: