Jannos-443
VMWare VM disk space monitoring
Using VMware PowerCLI this Script checks disk space of every VM.
Exceptions can be made within this script by changing the variable $IgnoreScript. This way, the change applies to all PRTG sensors based on this script. If exceptions have to be made on a per sensor level, the script parameter $IgnorePattern can be used.
-
Make sure the VMware PowerCLI Module exists on the Probe under the Powershell Module Path
C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Core
-
Place
PRTG-VMware-Snapshot-Age.ps1
underC:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML
-
Create new Sensor
Settings Value EXE/Script Advanced PRTG-VMware-DiskSpace.ps1 Parameters -ViServer 'yourVCenter' -User 'yourUser' -Password 'yourPassword' Scanning Interval 30 minutes -
Set the "$IgnorePattern" or "$IgnoreScript" parameter to Exclude VM disks
Example Call:
PRTG-VMware-Snapshot.ps1 -ViServer '%VCenter%' -User '%Username%' -Password '%PW%' -IgnorePattern '^(FileSVR1:C:\\)$'
Double \ is needed because you have to escaped the \ in C:\
Example1:
exclude "C:\" from the VM "FileSVR1"
-IgnorePattern '^(FileSVR1:C:\\)$'
Example2:
exclude "C:\" from the VM "FileSVR1" and "/" (root) from a linux VM "LinuxVM"
-IgnorePattern '^(FileSVR1:C:\\|LinuxVM:/)$'
Example3:
example2 and exlude all disk from VM "TestSVR23"
-IgnorePattern '^(FileSVR1:C:\\|LinuxVM:/|TestSVR23.*)$'
Example Output:
For more information about regular expressions in PowerShell, visit Microsoft Docs.
".+" is one or more charakters ".*" is zero or more charakters