Overall objective is to create disk latency sensors to get sec/write and sec/write from Windows servers. Here's what I've tried so far, any guidance greatly appreciated.
- Inbuilt sensor - I couldn't find one, could you please add this to the feature request list.
- Custom WMI sensor - "SELECT AvgDisksecPerWrite FROM Win32_PerfFormattedData_PerfDisk_PhysicalDisk" rounds down the values to 0 so doesn't give anything useful.
- Custom Powershell (code below) - The script works from a powershell prompt on the probe device (logged on with my credentials) when run against any server. The script works in PRTG when the $hostname parameter passed is the probe device but for any other server the get-counter method errors (error.txt => Get-Counter : Unable to access the desired machine or service. Check the permissions and authentication ....). The sensor security context is "Use Windows credentials of parent device" and the parent device (ie server) settings are set to override defaults and use my credentials. Powershell is set to "unrestricted". I think this may be an issue with not being able to passthrough credentials multiple levels but, as get-counter doesn't support -cred parameter I can't workaround that. Does PRTG work with powershell scripts that query remote computers? All the demo scripts just reference 127.0.0.1.
Any ideas on how else to get these values would be greatly appreciated.
#(Powershell script for sec/write) param($hostname, $disk) # $hostname = "_servername_removed_" # $disk = "_Total" $countername = "\PhysicalDisk("+$disk+")\Avg. Disk sec/Write" $counter = Get-Counter -ComputerName $hostname -Counter $countername $error | Out-File c:\temp\error.txt [float]$value = (($counter.Readings.Split("`n"))[1]) $value = $value * 1000 write-host $value,":OK"
Add comment