Monitoring CSV Free Disk Space with PRTG
Posted in Virtual Machine Manager, Windows Powershell | 4 Comments | 15,212 views | 08/03/2011 15:04
You can not monitor CSV Free Disk Space with PRTG by default. You should use custom scripts to do that. So I decided to write a Powershell script for that. But instead of using WMI in Powershell, using Powershell commands with Remote Powershell is a lot easier. Also this is an example for you about how to execute your own Powershell scripts on remote servers. Also this is a great example for Remote Powershell functionality if you are not familiar with it.
First of all, you need my PS1 script for monitoring:
Now save as this script as “CSV Free Disk Space.ps1” and copy it to the “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE” folder on the PRTG -Probe- server. Only one note, you should change Domain and Password info in the script. You should write your Administrator name as “CONTOSO\Administrator”. You should write your password as clean text but I’ll work about that to find a way to encrypt it. Just change “PASSWORD_HERE” line and “DOMAN\Administrator” line in the script.
Before adding sensor on to PRTG, you should configure Remote Powershell functionality on PRTG server and on one of the Hyper-V Cluster Host.
First, go to PRTG host and execute on Powershell:
One important note. If you use Windows Server 2008 R2 or Windows x64 versions, you should execute commands on both x86 version of Powershell and x64 version of Powershell.
x86 path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
x64 path: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
Also you may need to disable UAC to execute Remote Powershell commands!
Then go to Hyper-V Cluster Host and execute:
Now go to the PRTG and create a custom sensor for Hyper-V Cluster Host.
Only one important thing is “Parameters”. You should write exactly same things there:
If you have more than one CSV disk, just add them as a new sensor and parameters should be:
After a few minutes, PRTG will start showing Free Space information.
Actually I added “Used Space” to the PRTG. You can change it as “Free Space” if you want.
There are lines in the script:
Just remove the last line like here:
I hope this will help you to monitor your environment.
Leave a Reply