Community discussions

MikroTik App
 
S8T8
Member Candidate
Member Candidate
Topic Author
Posts: 129
Joined: Thu Sep 15, 2022 7:15 pm

Netwatch script to report downtime?

Fri Aug 18, 2023 5:48 pm

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?
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1092
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Netwatch script to report downtime?

Sun Aug 20, 2023 11:28 pm

Have a look at my scripts, it can do that - and a lot more:
https://git.eworm.de/cgit/routeros-scri ... -notify.md
 
msatter
Forum Guru
Forum Guru
Posts: 2942
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Netwatch script to report downtime?

Mon Aug 21, 2023 12:23 am

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.
 
S8T8
Member Candidate
Member Candidate
Topic Author
Posts: 129
Joined: Thu Sep 15, 2022 7:15 pm

Re: Netwatch script to report downtime?

Fri Aug 25, 2023 1:36 pm

Thanks @eworm, I'm a big fan of your Repo, very intresting :) 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..."

Who is online

Users browsing this forum: No registered users and 20 guests