When using Performance Monitor sensors to graph details of RDP sessions the sensors will go into alarm when the RDP session is disconnected.
As an example the counter '\Terminal Services Session(RDP-Tcp 6)\Total Compressed Bytes' will be available when the RDP server assigns a user to session 6 and return 'No data to return. (Performance Counter error 0x800007D5)' when the user disconnects.
Short of writing a loopback to use the API to auto-acknowledge the sensor, is there any way to recognise the specific error of an and handle it gracefully? This is not actually an error, just Windows advising that there is no data available, so it should be handled as a null (or zero) value.
Article Comments
Thanks Greg.
A Powershell script worked well for this purpose and hasn't caused any performance issues.
For the benefit of anyone else trying to monitor RDP bandwidth I'll include the script. This is a simple example only, no proper error handling and has the machine to monitor hard-coded.
$ErrorActionPreference= 'silentlycontinue' Try { $result= (Get-Counter -counter "Terminal Services Session(RDP-Tcp $args)\Total Compressed Bytes" -ComputerName [SERVER NAME]).CounterSamples[0].CookedValue "$result" + ":Session $args OK" } Catch { "0:Session $args Unavailable" }
Jun, 2014 - Permalink
The only way to resolve this issue would be to have it auto-acknowledge or you could set it up to automatically pause. Unfortunately this would apply to all errors not only to a specific error, there is no way to have notifications trigger for specific errors.
The only way that I can think of that you could set this up in PRTG is to use a script to retrieve this data and there you would be able to define what an error is or not and you could have the script return 0 value when the user is disconnected.
More information about the custom script sensors can be found under Setup->PRTG API->Custom Sensors.
Jun, 2014 - Permalink