Commit graph

69 commits

Author SHA1 Message Date
Christian Hesse
a832fd04ef rename scripts and add file extension ".rsc"
No functional change for the user... The migration is done
automatically.
2023-03-07 22:26:01 +01:00
Christian Hesse
8213c5ed61 netwatch-notify: support sending silent notifications 2023-02-24 12:13:35 +01:00
Christian Hesse
2f774f723d update copyright for 2023 2023-01-02 23:49:26 +01:00
Christian Hesse
0ad94b042d netwatch-notify: support type https-get
... which was introduced in RouterOS 7.7beta8.
2022-11-25 08:39:07 +01:00
Christian Hesse
6822e71564 netwatch-notify: cache the result
If this script runs from terminal this will not change... 😜
So cache the result.

Co-authored-by: Michael Gisbers <michael@gisbers.de>
2022-10-21 15:00:42 +02:00
Michael Gisbers
a0163aa487 netwatch-notify: always show messages when run from terminal
Co-authored-by: Christian Hesse <mail@eworm.de>
2022-10-21 15:00:41 +02:00
Christian Hesse
c3da4ed696 netwatch-notify: stop flooding the log after down notification
This will now log all messages before notification, and every two hours
(or scheduler interval * 120) after.
2022-10-21 15:00:39 +02:00
Christian Hesse
640cb81119 netwatch-notify: fix the count...
This broke in commit 6f772e92a6
("netwatch-notify: rename array element") where not only the array
element but also the option was renamed.
2022-10-14 22:39:21 +02:00
Christian Hesse
493e4fc8c1 netwatch-notify: use a counter for resolve failures
This should relax the error message a bit as it is not triggered
on first failure.
2022-09-20 22:49:04 +02:00
Christian Hesse
5aff4019fe netwatch-notify: do not (yet) notify if parent is up recently
Monitoring a VPN (or similar) may be tricky: This used to send notifications
if the physical connection recovered, but the VPN and/or its routing did not
yet. Let's work around and send notification only if the parent is up
for at least three checks.
2022-09-07 22:20:52 +02:00
Christian Hesse
a6645b3e75 netwatch-notify: add new array element to count up-checks 2022-09-07 22:02:46 +02:00
Christian Hesse
6f772e92a6 netwatch-notify: rename array element 2022-09-07 21:54:57 +02:00
Christian Hesse
95274e0d23 netwatch-notify: rename variable 2022-09-07 21:54:14 +02:00
Christian Hesse
a7f8aa95d0 netwatch-notify: show dns name (resolve option) in message 2022-09-07 11:21:15 +02:00
Christian Hesse
d6337fcc97 netwatch-notify: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:35:32 +02:00
Christian Hesse
3a7bb1e239 netwatch-notify: break long lines 2022-07-06 11:37:02 +02:00
Christian Hesse
8e6eff30db netwatch-notify: also support the name from property 2022-07-06 11:37:02 +02:00
Christian Hesse
5767fceb39 netwatch-notify: quote the host/service name 2022-07-06 11:37:02 +02:00
Christian Hesse
e8f5f9217c netwatch-notify: properly handle services (http-get & tcp-conn) 2022-07-06 11:37:02 +02:00
Christian Hesse
f50d155500 netwatch-notify: $NetwatchNotifyHook: rename variable: $Type -> $State 2022-07-06 11:37:02 +02:00
Christian Hesse
a7c9444545 netwatch-notify: rename variable: $HostName -> $Name 2022-07-06 11:37:02 +02:00
Christian Hesse
19103cd345 netwatch-notify: rename parameter: hostname -> name
Starting with RouterOS 7.4 the netwatch tool has been extended, it can
now do tcp and http probes. Rename the parameter for reasonable naming
with services.
2022-07-06 11:37:02 +02:00
Christian Hesse
5a02c32d7d netwatch-notify: properly check for disabled state
Looks like checking for 'disabled=no' fails with net netwatch
in RouterOS 7.4...
2022-07-06 11:37:02 +02:00
Christian Hesse
9aa82316c8 global-functions: rename internal function: $DNSIsResolving -> $IsDNSResolving 2022-06-20 11:29:49 +02:00
Christian Hesse
b368ee9902 netwatch-notify: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
0b46c508dc netwatch-notify: nest conditions
The logic here was right, but RouterOS runs the checks simultaneously.
This caused delays even if no resolving was needed.

Nesting the checks fixes this.
2022-02-10 08:41:12 +01:00
Christian Hesse
c6e581d4f9 netwatch-notify: allow to suppress notification on host down 2022-02-10 08:41:12 +01:00
Christian Hesse
cd3fde59d7 netwatch-notify: give netwatch some time to settle 2022-01-03 10:00:16 +01:00
Christian Hesse
491ecdb812 netwatch-notify: initialize after lock 2022-01-03 10:00:16 +01:00
Christian Hesse
7f0a8cdfcd netwatch-notify: better match notify-entries 2022-01-03 10:00:16 +01:00
Christian Hesse
95e9820718 update copyright for 2022 2022-01-01 21:38:15 +01:00
Christian Hesse
7afce17f70 netwatch-notify: use $ScriptLock 2021-08-27 11:20:57 +02:00
Christian Hesse
bccb7c3452 netwatch-notify: implement pre-down hook 2021-07-09 12:46:03 +02:00
Christian Hesse
c5d49b37f3 netwatch-notify: run hook from a function 2021-07-08 13:38:21 +02:00
Christian Hesse
87ce4a86b7 netwatch-notify: add error handling for hooks
We already had syntax validation, but a script with valid synctax can
still fail to run...
2021-07-08 13:02:57 +02:00
Christian Hesse
05a7ae409b netwatch-notify: add info on hook in notification 2021-05-18 16:44:07 +02:00
Christian Hesse
96621e01cb netwatch-notify: log failed resolve just once 2021-05-06 15:34:04 +02:00
Christian Hesse
0b1bb0f2b2 netwatch-notify: attempt to update address with working resolver only 2021-05-06 15:33:52 +02:00
Christian Hesse
cfb31e844c netwatch-notify: support dynamic address update 2021-05-06 15:11:05 +02:00
Christian Hesse
9d19313eee netwatch-notify: log on host up...
... if logged on host down before.
2021-05-06 15:11:05 +02:00
Christian Hesse
e6223a3661 netwatch-notify: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
557016387c netwatch-notify: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
99d3e5d578 netwatch-notify: use $ValidateSyntax 2021-02-26 16:23:13 +01:00
Christian Hesse
f46db91845 global: give script or function name in log messages 2021-02-24 21:51:54 +01:00
Christian Hesse
d5afc79eed global: drop script 'global-wait'
All scripts wait for the global functions on their own now.
2021-02-18 21:45:38 +01:00
Christian Hesse
547fbc630a update copyright for 2021 2021-01-01 21:33:52 +01:00
Christian Hesse
23923619dd netwatch-notify: increase count for every parent in chain 2020-11-17 22:28:05 +01:00
Christian Hesse
e7855b4611 netwatch-notify: support parents in a chain 2020-11-17 22:28:05 +01:00
Christian Hesse
d5125b816a netwatch-notify: be more verbose in logs 2020-11-17 22:28:05 +01:00
Christian Hesse
6c14412aa9 netwatch-notify: implemented simple dependency model 2020-11-17 22:28:05 +01:00