Router offline send notification

Hello,

Does anyone know of a solution to send an email notification OpenWrt when the router goes offline and loses the internet connection?

I want to be notified if the device loses the internet connection.

Kind of a catch 22, isn't it?

How will you tell anyone the internet's down, if the internet is down?

You can do it from outside your LAN, of if you have a LTE stick or cell phone hooked up somewhere in your LAN.

1 Like

I can think of at least two options

  1. Have a look at mqtt and Last Will/Testatment:
    choose a public mqttbroker.
    on the router install a mqtt-client with opkg (eg mosquitto-client(-ssl)) and publish a last will to the broker.
    Then you will be able to subscripe to the message, eg. from a mqtt client on you phone.

  2. If you prefer, you can run a webserver with uhttpd and forward a port from wan and use uptimerobot. You will then get notified by mail from uptimerobot, when it cannot reach the webserver
    I think you will need to setup dynamic dns if you choose this method

3 Likes

Just had a look on uptimerobot. You can also monitor with ping, so no need to setup a webserver

uptimerobot also has a heartbeat or cron job check. Works opposite direction so your router would wget a URL every so often via cron job. Unfortunately, it requires a paid account. Search for 'free cron job monitoring' or similar. A brief look at healthchecks.io looks ok.

Or, I saw a post about logging your router events to humio or other cloud logs. Then maybe you could create rule to notify you if id doesn't receive a heartbeat log. (run logger command via cron job).