Netwatch script to report downtime?

Hello, hope title is appropriate and clear;
recently had WAN issues reported by Netwatch, would be useful to receive a notification like “Internet was not available from 2PM to 3PM” or “… for 1 hour”.

I was thinking about something like:

:global Uptime; :global Downtime; global Sometime
:set Uptime [/system resource get uptime] #(Added to up script)
:set Downtime [/system resource get uptime] #(Added to down script)
:set $Sometime ($Uptime - $Downtime)
:log info "$Sometime ..."

unfortunately seems that Netwatch has limited permissions and Global not available.

Any alternative to suggest please?

Have a look at my scripts, it can do that - and a lot more:
https://git.eworm.de/cgit/routeros-scripts/about/doc/netwatch-notify.md

By the way, uptime is the time the router has been powered on. When you power-off the router, then even if you could store the global, it will be erased on reboot.

Thanks @eworm, I’m a big fan of your Repo, very intresting :slight_smile: Will look into it, thanks!
@msatter, I found “uptime” easy for what I would like to have, a log entry like “Internet not available for 10 min…”