Check Disk Space on Windows Servers From Linux
I stumbled backwards accidentally and discovered a feature where I can track disk space on Windows servers from Linux.
Just put a share on each drive you want to monitor on each windows server.
Then, install smbfs on your Linux system if you don't have that already.
Then, mount each of these shares using a syntax like:
mount -t smbfs -o 'username=MIKE,password=MYPASS,workgroup=MYDOMAIN,rw' //WINSRV1/SHARE1 /mnt/winsrv1share1
Now, do this:
df -h | grep -i "//WINSRV1/SHARE1" | cut -d " " -f 8
...and you get the used disk space
df -h | grep -i "//WINSRV1/SHARE1" | cut -d " " -f 11
...and you get the disk space left
df -h | grep -i "//WINSRV1/SHARE1" | cut -d " " -f 13
...and you get the percentage of disk space used.
Now you can write scripts to track disk space and send you email alerts.









