Ensure that you receive alerts when your critical devices come online. This guide will walk you through the setup of receiving alerts for online devices using threshold profiles.
Important Note: It is crucial to be aware that Atera support does not offer provisioning and assistance for this particular setup.
Online status script
To establish online status alerts for your crucial devices, the initial step involves creating this Powershell script in your Atera instance.
$server = "8.8.8.8" # Google DNS server, replace with any reliable server
$onlineDuration = 5 # Duration in minutes for considering the machine as online
$onlineTime = $null
function Test-InternetConnection {
param (
[string]$server
)
$ping = Test-Connection -ComputerName $server -Count 1 -Quiet
return $ping
}
while ($true) {
if (Test-InternetConnection -server $server) {
if ($onlineTime -eq $null) {
$onlineTime = Get-Date
} elseif ((Get-Date) - $onlineTime -ge [TimeSpan]::FromMinutes($onlineDuration)) {
Write-Host "The machine is online"
break
}
} else {
$onlineTime = $null
}
Start-Sleep -Seconds 30 # Check every 30 seconds
}
Some parameters might require changes from your end.
Replace $server
with the address of a reliable server, or leave it as it is.
Set $onlineDuration
to the desired duration in minutes for considering the machine as online.
To learn more about creating a script in Atera, please visit this article:
Setup threshold profile
Upon successfully uploading the script to Atera, the subsequent step involves creating a Script-based threshold item. You have the flexibility to either establish a new threshold profile or seamlessly add a new threshold item to your existing profile.
For detailed information on Script-based threshold items and instructions on editing threshold profiles, please refer to the articles provided below.
When creating the Script-based threshold item, use the parameters from below.
- Alert title - Add a title that you wish.
- Monitoring script - Select the Online status script you have uploaded to your instance.
- Alert severity - Select the severity of the alert that you wish.
- Threshold value type - Select Text.
- Operator - Select Equals.
- Value - Add in the following value: The machine is online
- Time period - 1.5 minutes
After creating the threshold item, make sure to save the changes. Now, when an agent appears online, you will get an alert within Atera. It is important to note that the alert is not generated immediately.
Special thanks to stuarthill and tanderson. We greatly appreciate your valuable contribution to the Atera community.