Online notification

Options
stuarthill
stuarthill Member Posts: 5

Hello all,

Firstly - apologies as I'm new to Atera, having just come from Datto.

I can see that we can setup notification (availability monitoring) for when devices go offline, but does anyone have any recommendation for an alert/email for when a device [that is normally offline] comes ONline ?

Essentially the opposite of the availability monitoring would be perfect but the option doesn't exist.

Support recommend enabling the emailing of alert resolutions, but this would be a sledgehammer solution and result in emails for ALL resolved alerts for that Customer which is not what is wanted.

Thoughts so far include :
1. Searching event log for "6005" events - but the user might be operating offline for many weeks, then when they come online we get dozens of alerts for every time they started the device ?

2. Scripted pings to Google - but we only want one alert a day really for this.


Perhaps I should get my code on and make something that does what is required but before I do this I thought I would ask you lot :)

Tagged:

Comments

  • tanderson
    tanderson Member Posts: 198 ✭✭✭✭
    Options

    @stuarthill I believe a Threshold profile could work for this. Because the event will only be alerted when there is internet connection, I don't think you will be flooded with past events. (If a machine has been offline but powered on and off over the course of a month) However, some testing would be needed to confirm that theory. Let me know how it goes.

  • stuarthill
    stuarthill Member Posts: 5
    Options

    Thanks for the feedback @tanderson I have added that threshold and applied it to a test machine.

    This works but only when the machine is restarted while online.

    I'll have a play with the scripting ping to google and see if this can also work.

  • tanderson
    tanderson Member Posts: 198 ✭✭✭✭
    Options

    @stuarthill Maybe try with event ID 6009

  • nina
    nina Administrator Posts: 428 admin
    edited November 2023
    Options

    As always, thanks @tanderson!

  • stuarthill
    stuarthill Member Posts: 5
    Options

    Apologies @tanderson I have recently been able to get some quiet time to look into this further.

    I have found that a Script-based threshold item appears to be working :


    The "Online Monitor [WIN].ps1" script contains :


    $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
    }


    So I've tested it only once, but so far it's a 100% win :)

  • nina
    nina Administrator Posts: 428 admin
    Options

    Thanks @stuarthill !!!