You do not use SCOM to monitor your infrastructure (sorry guys!) but you definitely want to use PowerShell? Ok great news, if you use PRTG to monitor your machines, then you can still use PowerShell! Recently, I worked on PRTG to monitor a Direct Access infrastructure but there was no available sensor to check DirectAccess. But there is a custom sensor that will run a PowerShell script. Nothing complicated:
First, you need to create your PowerShell script with the following structure:
Try { $DAC = Get-RemoteAccessConnectionStatisticsSummary -ComputerName YourDACServer } Catch [system.exception] { } Finally { $myxml = '<prtg>' + "`n" + '<result>' + "`n" + '<channel>TotalVPNConnections</channel>' + "`n" + '<value>' + $DAC.TotalVpnConnections + '</value>' + "`n" + '</result>' + "`n" + '<result>' + "`n" + '<unit>Custom</unit>' + "`n" + '<Customunit>MB</Customunit>' + "`n" + '<VolumeSize>MegaByte</VolumeSize>' + "`n" + '<Float>1</Float>' + "`n" + '<channel>Total Bytes In Out</channel>' + "`n" + '<value>' + ($DAC.TotalBytesInOut/(1024*1024)) + '</value>' + "`n" + '</result>' + "`n" + '<result>' + "`n" + '<channel>TotalCumulativeConnections</channel>' + "`n" + '<value>' + $DAC.TotalCumulativeConnections + '</value>' + "`n" + '</result>' + "`n" + '</prtg>' $myxml }
This script will check the Direct Access statistics and will return 3 values:
- TotalVPNConnections
- TotalBytesInOut
- TotalCumulativeConnections
Then copy and paste your PowerShell script into the following directory:
C:\PRTG Network Monitor\Custom Sensors\EXEXML\
Now, add a custom sensor “script/EXE” in the PRTG GUI. PRTG gives a drop-down menu in the PRTG web interface that lists the contents of the EXEXML directory.
The output will be something like the following:
Done!
Thanks for reading! You can follow me on Twitter @PrigentNico