Though Automate/LabTech has built-in tests for website latency and simple ping up/down checks, there is nothing in place for monitoring latency/response time on a network.
This can be achieved by doing the following:
- Right click the agent you want to install the monitor on, Monitors > Add New Monitor
- Choose Yes to create using the Wizard
- Choose Monitor the results of an Executable
- In the Executable / Arguments box – paste the following code (it should all be one line and you should replace www.google.co.uk with your server/ip you want to test
"c:\windows\system32\windowspowershell\v1.0\powershell.exe" -command "& {$Avg = 0;$Server = \"www.google.co.uk\";$PingServer = Test-Connection -count 3 $Server;$Avg = ($PingServer | Measure-Object ResponseTime -average);$Calc = [System.Math]::Round($Avg.average);Write-output $calc}"
- In a Remote Monitor you are monitoring for the GOOD condition, not the bad, so lets say we want to trigger this monitor when the average response is over 50 MS, in Comparison Function choose Less Than and in the Compare result against type 50
- Choose Next.
- Set the Frequency to however often you want to check
- Set the Alert Style (how many times the monitor has to fail before an alert is triggered) to whatever value you wish, and set the alert template to alert however you want to alert.
- Leave the defaults for Alert Message, if you want to customise this then make sure the subjects are identical for Success and Failure
- Set the monitor name, I have my own convention – TEST TYPE – Brief Description – Custom (Company Name), so in this instance PING – Latency to Google is under 50ms – Custom (Gavsto)
- Click Finish
- Give it a minute or two to create then bring back results from the monitor
Hi Gavsto,
Great blog!
I keep on getting these failures in the history…any idea?
Test-Connection : Testing connection to computer ‘www.google.com’ failed:
Error due to lack of resources
At line:1 char:54
+ & {$Avg = 0;$Server = “www.google.com”;$PingServer = Test-Connection -c
Here is the screenshot of the config: https://snag.gy/0Wul7C.jpg
Here is the run: “c:\windows\system32\windowspowershell\v1.0\powershell.exe” -command “& {$Avg = 0;$Server = \”www.google.com\”;$PingServer = Test-Connection -count 3 $Server;$Avg = ($PingServer | Measure-Object ResponseTime -average);$Calc = [System.Math]::Round($Avg.average);Write-output $calc}”
Just to add, the same servers that give these failures also get successes so I’m not sure what is causing it…maybe it’s busy with Windows Updates? Any ideas?