aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BRANCHES.md2
-rw-r--r--CERTIFICATES.md5
-rw-r--r--CONTRIBUTIONS.md3
-rw-r--r--INITIAL-COMMANDS.md2
-rw-r--r--README.md42
-rw-r--r--doc/backup-cloud.md3
-rw-r--r--doc/backup-partition.md2
-rw-r--r--doc/backup-upload.md1
-rw-r--r--doc/check-certificates.md1
-rw-r--r--doc/check-health.md1
-rw-r--r--doc/check-lte-firmware-upgrade.md4
-rw-r--r--doc/check-perpetual-license.md1
-rw-r--r--doc/check-routeros-update.md5
-rw-r--r--doc/collect-wireless-mac.md1
-rw-r--r--doc/daily-psk.md1
-rw-r--r--doc/fw-addr-lists.md8
-rw-r--r--doc/log-forward.md9
-rw-r--r--doc/mod/notification-email.md3
-rw-r--r--doc/mod/notification-gotify.d/appsetup.avifbin0 -> 18099 bytes
-rw-r--r--doc/mod/notification-gotify.md97
-rw-r--r--doc/mod/notification-matrix.md3
-rw-r--r--doc/mod/notification-ntfy.md5
-rw-r--r--doc/mod/notification-telegram.md7
-rw-r--r--doc/netwatch-notify.md1
-rw-r--r--doc/sms-forward.md1
-rw-r--r--global-config.rsc6
-rw-r--r--global-functions.rsc8
-rw-r--r--mod/notification-gotify.rsc139
-rw-r--r--mod/notification-ntfy.rsc1
-rw-r--r--news-and-changes.rsc1
30 files changed, 325 insertions, 38 deletions
diff --git a/BRANCHES.md b/BRANCHES.md
index 8a0bdad..dc4f4ac 100644
--- a/BRANCHES.md
+++ b/BRANCHES.md
@@ -13,7 +13,7 @@ Installing from branches
> ⚠️ **Warning**: Living on the edge? Great, read on!
> If not: Please use the `main` branch and leave this page!
-These scripts are developed in a [git](https://git-scm.com/) repository.
+These scripts are developed in a [git ↗️](https://git-scm.com/) repository.
Development and experimental branches are used to provide early access
for specific changes. You can install scripts from these branches
for testing.
diff --git a/CERTIFICATES.md b/CERTIFICATES.md
index 5432d78..69d6c18 100644
--- a/CERTIFICATES.md
+++ b/CERTIFICATES.md
@@ -21,7 +21,7 @@ first step of [installation](README.md#the-long-way-in-detail) is importing
the certificate.
The scripts can install additional certificates when required. This happens
-from this repository if available, or from [mkcert.org](https://mkcert.org)
+from this repository if available, or from [mkcert.org ↗️](https://mkcert.org)
as a fallback.
Get the certificate's CommonName
@@ -29,7 +29,7 @@ Get the certificate's CommonName
But how to determine what certificate may be required? Often easiest way
is to use a desktop browser to get that information. This demonstration uses
-[Mozilla Firefox](https://www.mozilla.org/firefox/).
+[Mozilla Firefox ↗️](https://www.mozilla.org/firefox/).
Let's assume we want to make sure the certificate for
[git.eworm.de](https://git.eworm.de/) is available. Open that page in the
@@ -74,6 +74,7 @@ See also
* [Download, import and update firewall address-lists](doc/fw-addr-lists.md)
* [Manage DNS and DoH servers from netwatch](doc/netwatch-dns.md)
+* [Send notifications via Gotify](doc/mod/notification-gotify.md)
* [Send notifications via Matrix](doc/mod/notification-matrix.md)
* [Send notifications via Ntfy](doc/mod/notification-ntfy.md)
diff --git a/CONTRIBUTIONS.md b/CONTRIBUTIONS.md
index 55d2205..5bf5d08 100644
--- a/CONTRIBUTIONS.md
+++ b/CONTRIBUTIONS.md
@@ -22,6 +22,7 @@ for details!
* [Daniel Ziegenberg](mailto:daniel@ziegenberg.at) (@ziegenberg)
* [Ignacio Serrano](mailto:ignic@ignic.com) (@ignic)
* [Ilya Kulakov](mailto:kulakov.ilya@gmail.com) (@Kentzo)
+* [Leonardo David Monteiro](mailto:leo@cub3.xyz) (@leosfsm)
* [Michael Gisbers](mailto:michael@gisbers.de) (@mgisbers)
* [Miquel Bonastre](mailto:mbonastre@yahoo.com) (@mbonastre)
* @netravnen
@@ -31,7 +32,7 @@ for details!
## Donations
Add yourself to the list,
-[donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)!
+[donate with PayPal ↗️](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)!
* Abdul Mannan Abbasi
* Andrea Ruffini Perico
diff --git a/INITIAL-COMMANDS.md b/INITIAL-COMMANDS.md
index 65b313b..79773bd 100644
--- a/INITIAL-COMMANDS.md
+++ b/INITIAL-COMMANDS.md
@@ -10,7 +10,7 @@ Initial commands
[⬅️ Go back to main README](README.md)
-> ⚠️ **Warning**: These command are inteneded for initial setup. If you are
+> ⚠️ **Warning**: These commands are intended for initial setup. If you are
> not aware of the procedure please follow
> [the long way in detail](README.md#the-long-way-in-detail).
diff --git a/README.md b/README.md
index 1f7c8ed..2a8b2ce 100644
--- a/README.md
+++ b/README.md
@@ -10,13 +10,14 @@ RouterOS Scripts
![RouterOS Scripts Logo](logo.svg)
-[RouterOS](https://mikrotik.com/software) is the operating system developed
-by [MikroTik](https://mikrotik.com/aboutus) for networking tasks. This
-repository holds a number of [scripts](https://wiki.mikrotik.com/wiki/Manual:Scripting)
+[RouterOS ↗️](https://mikrotik.com/software) is the operating system developed
+by [MikroTik ↗️](https://mikrotik.com/aboutus) for networking tasks. This
+repository holds a number of [scripts ↗️](https://wiki.mikrotik.com/wiki/Manual:Scripting)
to manage RouterOS devices or extend their functionality.
*Use at your own risk*, pay attention to
-[license and warranty](#license-and-warranty)!
+[license and warranty](#license-and-warranty), and
+[disclaimer on external links](#disclaimer-on-external-links)!
Requirements
------------
@@ -35,7 +36,7 @@ Specific scripts may require even newer RouterOS version.
> running RouterOS v6 switch to `routeros-v6` branch!
Starting with RouterOS 7.17 the
-[device-mode](https://help.mikrotik.com/docs/spaces/ROS/pages/93749258/Device-mode)
+[device-mode ↗️](https://help.mikrotik.com/docs/spaces/ROS/pages/93749258/Device-mode)
has been extended to give more fine-grained control over what features are
available. You need to enable `scheduler` and `fetch` at least, specific
scripts may require additional features.
@@ -61,9 +62,9 @@ First time users should take the long way below.
### Live presentation
Want to see it in action? I've had a presentation [Repository based
-RouterOS script distribution](https://www.youtube.com/watch?v=B9neG3oAhcY)
+RouterOS script distribution ↗️](https://www.youtube.com/watch?v=B9neG3oAhcY)
including demonstation recorded live at [MUM Europe
-2019](https://mum.mikrotik.com/2019/EU/) in Vienna.
+2019 ↗️](https://mum.mikrotik.com/2019/EU/) in Vienna.
> ⚠️ **Warning**: Some details changed. So see the presentation, then follow
> the steps below for up-to-date commands.
@@ -83,7 +84,7 @@ Note that the commands above do *not* verify server certificate, so if you
want to be safe download with your workstations's browser and transfer the
file to your MikroTik device.
-* [ISRG Root X2](https://letsencrypt.org/certs/isrg-root-x2.pem)
+* [ISRG Root X2 ↗️](https://letsencrypt.org/certs/isrg-root-x2.pem)
Then we import the certificate.
@@ -122,6 +123,9 @@ And finally load configuration and functions and add the scheduler.
![screenshot: run and schedule scripts](README.d/05-run-and-schedule-scripts.avif)
+> 💡️ **Hint**: You see complaints regarding syntax errors? Most likely the
+> RouterOS on your device is too old. Check for updates!
+
### Scheduled automatic updates
The last step is optional: Add this scheduler **only** if you want the
@@ -191,7 +195,7 @@ Scheduler and events
--------------------
Most scripts are designed to run regularly from
-[scheduler](https://wiki.mikrotik.com/wiki/Manual:System/Scheduler). We just
+[scheduler ↗️](https://wiki.mikrotik.com/wiki/Manual:System/Scheduler). We just
added `check-routeros-update`, so let's run it daily to make sure not to
miss an update.
@@ -264,6 +268,7 @@ Available modules
* [Inspect variables](doc/mod/inspectvar.md) (`mod/inspectvar`)
* [IP address calculation](doc/mod/ipcalc.md) (`mod/ipcalc`)
* [Send notifications via e-mail](doc/mod/notification-email.md) (`mod/notification-email`)
+* [Send notifications via Gotify](doc/mod/notification-gotify.md) (`mod/notification-gotify`)
* [Send notifications via Matrix](doc/mod/notification-matrix.md) (`mod/notification-matrix`)
* [Send notifications via Ntfy](doc/mod/notification-ntfy.md) (`mod/notification-ntfy`)
* [Send notifications via Telegram](doc/mod/notification-telegram.md) (`mod/notification-telegram`)
@@ -325,7 +330,7 @@ Possibly a scheduler and other configuration has to be removed as well.
Contact
-------
-We have a Telegram Group [RouterOS-Scripts](https://t.me/routeros_scripts)!
+We have a Telegram Group [RouterOS-Scripts ↗️](https://t.me/routeros_scripts)!
[![RouterOS Scripts Telegram Group](README.d/telegram-group.avif)](https://t.me/routeros_scripts)
@@ -349,7 +354,7 @@ at github.
This project is developed in private spare time and usage is free of charge
for you. If you like the scripts and think this is of value for you or your
business please consider to
-[donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J).
+[donate with PayPal ↗️](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J).
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=for-the-badge)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
@@ -368,6 +373,21 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[GNU General Public License](COPYING.md) for more details.
+Disclaimer on external links
+----------------------------
+
+Our website contains links to the websites of third parties ("external
+links"). As the content of these websites is not under our control, we
+cannot assume any liability for such external content. In all cases, the
+provider of information of the linked websites is liable for the content
+and accuracy of the information provided. At the point in time when the
+links were placed, no infringements of the law were recognisable to us.
+As soon as an infringement of the law becomes known to us, we will
+immediately remove the link in question.
+
+> 💡️ **Hint**: All external links are marked with an arrow pointing
+> diagonally in an up-right (or north-east) direction (↗️).
+
Upstream
--------
diff --git a/doc/backup-cloud.md b/doc/backup-cloud.md
index 7286960..7d55d74 100644
--- a/doc/backup-cloud.md
+++ b/doc/backup-cloud.md
@@ -17,7 +17,7 @@ Description
-----------
This script uploads
-[binary backup to Mikrotik cloud](https://wiki.mikrotik.com/wiki/Manual:IP/Cloud#Backup).
+[binary backup to Mikrotik cloud ↗️](https://wiki.mikrotik.com/wiki/Manual:IP/Cloud#Backup).
> ⚠️ **Warning**: The used command can hit errors that a script can with
> workaround only. A notification *should* be sent anyway. But it can result
@@ -49,6 +49,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/backup-partition.md b/doc/backup-partition.md
index 9d615a5..50b8a09 100644
--- a/doc/backup-partition.md
+++ b/doc/backup-partition.md
@@ -17,7 +17,7 @@ Description
-----------
This script saves the current configuration to fallback
-[partition](https://wiki.mikrotik.com/wiki/Manual:Partitions).
+[partition ↗️](https://wiki.mikrotik.com/wiki/Manual:Partitions).
It can also copy-over the RouterOS installation when run interactively
or just before a feature update.
diff --git a/doc/backup-upload.md b/doc/backup-upload.md
index 6a5b0e4..b4012c8 100644
--- a/doc/backup-upload.md
+++ b/doc/backup-upload.md
@@ -55,6 +55,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/check-certificates.md b/doc/check-certificates.md
index 4c144ba..a9426db 100644
--- a/doc/check-certificates.md
+++ b/doc/check-certificates.md
@@ -51,6 +51,7 @@ subject alternative name (aka *Subject Alt Name* or *SAN*) can be used.
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/check-health.md b/doc/check-health.md
index 7cf0c33..33847e3 100644
--- a/doc/check-health.md
+++ b/doc/check-health.md
@@ -113,6 +113,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/check-lte-firmware-upgrade.md b/doc/check-lte-firmware-upgrade.md
index 3693b71..a0c441e 100644
--- a/doc/check-lte-firmware-upgrade.md
+++ b/doc/check-lte-firmware-upgrade.md
@@ -44,7 +44,9 @@ Configuration
Also notification settings are required for
[e-mail](mod/notification-email.md),
-[matrix](mod/notification-matrix.md) and/or
+[gotify](mod/notification-gotify.md),
+[matrix](mod/notification-matrix.md),
+[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
See also
diff --git a/doc/check-perpetual-license.md b/doc/check-perpetual-license.md
index d444004..0335fb5 100644
--- a/doc/check-perpetual-license.md
+++ b/doc/check-perpetual-license.md
@@ -41,6 +41,7 @@ Configuration
No extra configuration is required for this script, but notification
settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/check-routeros-update.md b/doc/check-routeros-update.md
index b6c716c..a45e075 100644
--- a/doc/check-routeros-update.md
+++ b/doc/check-routeros-update.md
@@ -30,8 +30,8 @@ automatically is supported.
> ⚠️ **Warning**: Installing updates is important from a security point
> of view. At the same time it can be source of serve breakage. So test
> versions in lab and read
-> [changelog](https://mikrotik.com/download/changelogs/) and
-> [forum](https://forum.mikrotik.com/viewforum.php?f=21) before deploying
+> [changelog ↗️](https://mikrotik.com/download/changelogs/) and
+> [forum ↗️](https://forum.mikrotik.com/viewforum.php?f=21) before deploying
> to your production environment! Automatic updates should be handled
> with care!
@@ -73,6 +73,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/collect-wireless-mac.md b/doc/collect-wireless-mac.md
index 0197522..2378fed 100644
--- a/doc/collect-wireless-mac.md
+++ b/doc/collect-wireless-mac.md
@@ -54,6 +54,7 @@ entries are to be added.
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/daily-psk.md b/doc/daily-psk.md
index 4a3de64..118d768 100644
--- a/doc/daily-psk.md
+++ b/doc/daily-psk.md
@@ -79,6 +79,7 @@ For legacy local interface:
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[trix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/fw-addr-lists.md b/doc/fw-addr-lists.md
index cb560d7..d09383b 100644
--- a/doc/fw-addr-lists.md
+++ b/doc/fw-addr-lists.md
@@ -19,10 +19,10 @@ Description
This script downloads, imports and updates firewall address-lists. Its main
purpose is to block attacking ip addresses, spam hosts, command-and-control
servers and similar malicious entities. The default configuration contains a
-[collective list by GitHub user @stamparm](https://github.com/stamparm/ipsum),
-lists from [dshield.org](https://dshield.org/) and
-[blocklist.de](https://www.blocklist.de/), and lists from
-[spamhaus.org](https://spamhaus.org/) are prepared.
+[collective list by GitHub user @stamparm ↗️](https://github.com/stamparm/ipsum),
+lists from [dshield.org ↗️](https://dshield.org/) and
+[blocklist.de ↗️](https://www.blocklist.de/), and lists from
+[spamhaus.org ↗️](https://spamhaus.org/) are prepared.
The address-lists are updated in place, so after initial import you will not
see situation when the lists are not populated.
diff --git a/doc/log-forward.md b/doc/log-forward.md
index 3c19569..f6086c8 100644
--- a/doc/log-forward.md
+++ b/doc/log-forward.md
@@ -22,15 +22,15 @@ server (see `/system/logging`). This has some limitation, however:
* does not work early after boot if network connectivity is not
yet established, or breaks intermittently
* lots of messages generate a flood of mails
-* Matrix, Ntfy and Telegram are not supported
+* Gotify, Matrix, Ntfy and Telegram are not supported
The script works around the limitations, for example it does:
* read from `/log`, including messages from early boot
* skip multi-repeated messages
* rate-limit itself to mitigate flooding
-* forward via notification (which includes *e-mail*, *Matrix*, *Ntfy* and
- *Telegram* when installed and configured, see below)
+* forward via notification (which includes *e-mail*, *Gotify*, *Matrix*,
+ *Ntfy* and *Telegram* when installed and configured, see below)
It is intended to be run periodically from scheduler, then collects new
log messages and forwards them via notification.
@@ -72,7 +72,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
> your local `global-config-overlay` and modify it to your specific needs.
These patterns are matched as
-[regular expressions](https://wiki.mikrotik.com/wiki/Manual:Regular_Expressions).
+[regular expressions ↗️](https://wiki.mikrotik.com/wiki/Manual:Regular_Expressions).
To forward **all** (ignoring severity) log messages with topics `account`
(which includes user logins) and `dhcp` you need something like:
@@ -80,6 +80,7 @@ To forward **all** (ignoring severity) log messages with topics `account`
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/mod/notification-email.md b/doc/mod/notification-email.md
index 34d1c09..127bf96 100644
--- a/doc/mod/notification-email.md
+++ b/doc/mod/notification-email.md
@@ -32,7 +32,7 @@ Configuration
-------------
Set up your device's
-[e-mail settings](https://wiki.mikrotik.com/wiki/Manual:Tools/email).
+[e-mail settings ↗️](https://wiki.mikrotik.com/wiki/Manual:Tools/email).
Also make sure the device has correct time configured, best is to set up
the ntp client.
@@ -79,6 +79,7 @@ function available:
See also
--------
+* [Send notifications via Gotify](notification-gotify.md)
* [Send notifications via Matrix](notification-matrix.md)
* [Send notifications via Ntfy](notification-ntfy.md)
* [Send notifications via Telegram](notification-telegram.md)
diff --git a/doc/mod/notification-gotify.d/appsetup.avif b/doc/mod/notification-gotify.d/appsetup.avif
new file mode 100644
index 0000000..58f57a8
--- /dev/null
+++ b/doc/mod/notification-gotify.d/appsetup.avif
Binary files differ
diff --git a/doc/mod/notification-gotify.md b/doc/mod/notification-gotify.md
new file mode 100644
index 0000000..6fce629
--- /dev/null
+++ b/doc/mod/notification-gotify.md
@@ -0,0 +1,97 @@
+Send notifications via Gotify
+===========================
+
+[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
+[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
+[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
+[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
+[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
+[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
+
+[⬅️ Go back to main README](../../README.md)
+
+> ℹ️️ **Info**: This module can not be used on its own but requires the base
+> installation. See [main README](../../README.md) for details.
+
+Description
+-----------
+
+This module adds support for sending notifications via
+[Gotify ↗️](https://gotify.net/). A queue is used to make sure
+notifications are not lost on failure but sent later.
+
+Requirements and installation
+-----------------------------
+
+Just install the module:
+
+ $ScriptInstallUpdate mod/notification-gotify;
+
+Also deploy the [Gotify server ↗️](https://github.com/gotify/server) and
+optionally install a Gotify client on your mobile device.
+
+Configuration
+-------------
+
+Follow the [Installation ↗️](https://gotify.net/docs/install) instructions
+and the [First Login ↗️](https://gotify.net/docs/first-login) setup. Once
+you have a user and account you can start creating apps. Each app is an
+independent notification feed for a device or application.
+
+![Create new app](notification-gotify.d/appsetup.avif)
+
+On creation apps are assigned a *Token* for authentification, you will need
+that in configuration.
+
+Edit `global-config-overlay`, add `GotifyServer` with your server address
+(just the address, no protocol - `https://` is assumed) and `GotifyToken`
+with the *Token* from your configured app on the Gotify server. Then reload
+the configuration.
+
+> ℹ️ **Info**: Copy relevant configuration from
+> [`global-config`](../../global-config.rsc) (the one without `-overlay`) to
+> your local `global-config-overlay` and modify it to your specific needs.
+
+For a custom service installing an additional certificate may be required.
+You may want to install that certificate manually, after finding the
+[certificate name from browser](../../CERTIFICATES.md).
+
+Usage and invocation
+--------------------
+
+There's nothing special to do. Every script or function sending a notification
+will now send it to your Gotify application feed.
+
+But of course you can use the function to send notifications directly. Give
+it a try:
+
+ $SendGotify "Subject..." "Body...";
+
+Alternatively this sends a notification with all available and configured
+methods:
+
+ $SendNotification "Subject..." "Body...";
+
+To use the functions in your own scripts you have to declare them first.
+Place this before you call them:
+
+ :global SendGotify;
+ :global SendNotification;
+
+In case there is a situation when the queue needs to be purged there is a
+function available:
+
+ $PurgeGotifyQueue;
+
+See also
+--------
+
+* [Certificate name from browser](../../CERTIFICATES.md)
+* [Send notifications via e-mail](notification-email.md)
+* [Send notifications via Matrix](notification-matrix.md)
+* [Send notifications via Ntfy](notification-ntfy.md)
+* [Send notifications via Telegram](notification-telegram.md)
+
+---
+[⬅️ Go back to main README](../../README.md)
+[⬆️ Go back to top](#top)
diff --git a/doc/mod/notification-matrix.md b/doc/mod/notification-matrix.md
index 89c1b01..da6d6de 100644
--- a/doc/mod/notification-matrix.md
+++ b/doc/mod/notification-matrix.md
@@ -17,7 +17,7 @@ Description
-----------
This module adds support for sending notifications via
-[Matrix](https://matrix.org/) via client server api. A queue is used to
+[Matrix ↗️](https://matrix.org/) via client server api. A queue is used to
make sure notifications are not lost on failure but sent later.
Requirements and installation
@@ -131,6 +131,7 @@ See also
* [Certificate name from browser](../../CERTIFICATES.md)
* [Send notifications via e-mail](notification-email.md)
+* [Send notifications via Gotify](notification-gotify.md)
* [Send notifications via Ntfy](notification-ntfy.md)
* [Send notifications via Telegram](notification-telegram.md)
diff --git a/doc/mod/notification-ntfy.md b/doc/mod/notification-ntfy.md
index 51756ac..993501d 100644
--- a/doc/mod/notification-ntfy.md
+++ b/doc/mod/notification-ntfy.md
@@ -17,7 +17,7 @@ Description
-----------
This module adds support for sending notifications via
-[Ntfy](https://ntfy.sh/). A queue is used to make sure
+[Ntfy ↗️](https://ntfy.sh/). A queue is used to make sure
notifications are not lost on failure but sent later.
Requirements and installation
@@ -28,7 +28,7 @@ Just install the module:
$ScriptInstallUpdate mod/notification-ntfy;
Also install the Ntfy app on your mobile device or use the
-[web app](https://ntfy.sh/app) in a browser of your choice.
+[web app ↗️](https://ntfy.sh/app) in a browser of your choice.
Configuration
-------------
@@ -90,6 +90,7 @@ See also
* [Certificate name from browser](../../CERTIFICATES.md)
* [Send notifications via e-mail](notification-email.md)
+* [Send notifications via Gotify](notification-gotify.md)
* [Send notifications via Matrix](notification-matrix.md)
* [Send notifications via Telegram](notification-telegram.md)
diff --git a/doc/mod/notification-telegram.md b/doc/mod/notification-telegram.md
index 2d00116..804104f 100644
--- a/doc/mod/notification-telegram.md
+++ b/doc/mod/notification-telegram.md
@@ -17,7 +17,7 @@ Description
-----------
This module adds support for sending notifications via
-[Telegram](https://telegram.org/) via bot api. A queue is used to make sure
+[Telegram ↗️](https://telegram.org/) via bot api. A queue is used to make sure
notifications are not lost on failure but sent later.
Requirements and installation
@@ -33,7 +33,7 @@ and create an account.
Configuration
-------------
-Open Telegram, then start a chat with [BotFather](https://t.me/BotFather) and
+Open Telegram, then start a chat with [BotFather ↗️](https://t.me/BotFather) and
create your own bot:
![create new bot](notification-telegram.d/newbot.avif)
@@ -102,7 +102,7 @@ Tips & Tricks
### Set a profile photo
You can use a profile photo for your bot to make it recognizable. Open the
-chat with [BotFather](https://t.me/BotFather) and set it there.
+chat with [BotFather ↗️](https://t.me/BotFather) and set it there.
![set profile photo](notification-telegram.d/setuserpic.avif)
@@ -115,6 +115,7 @@ See also
* [Chat with your router and send commands via Telegram bot](../telegram-chat.md)
* [Send notifications via e-mail](notification-email.md)
+* [Send notifications via Gotify](notification-gotify.md)
* [Send notifications via Matrix](notification-matrix.md)
* [Send notifications via Ntfy](notification-ntfy.md)
diff --git a/doc/netwatch-notify.md b/doc/netwatch-notify.md
index 81adfe9..91c568f 100644
--- a/doc/netwatch-notify.md
+++ b/doc/netwatch-notify.md
@@ -47,6 +47,7 @@ The hosts to be checked have to be added to netwatch with specific comment:
Also notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/doc/sms-forward.md b/doc/sms-forward.md
index ccb6482..0c1317d 100644
--- a/doc/sms-forward.md
+++ b/doc/sms-forward.md
@@ -56,6 +56,7 @@ The configuration goes to `global-config-overlay`, this is the only parameter:
Notification settings are required for
[e-mail](mod/notification-email.md),
+[gotify](mod/notification-gotify.md),
[matrix](mod/notification-matrix.md),
[ntfy](mod/notification-ntfy.md) and/or
[telegram](mod/notification-telegram.md).
diff --git a/global-config.rsc b/global-config.rsc
index fa32b16..42a457a 100644
--- a/global-config.rsc
+++ b/global-config.rsc
@@ -63,6 +63,12 @@
:global NtfyServerToken "";
:global NtfyTopic "";
+# You can send Gotify notifications. Configure these settings and
+# install the module:
+# $ScriptInstallUpdate mod/notification-gotify
+:global GotifyServer "";
+:global GotifyToken "";
+
# It is possible to override e-mail, Telegram, Matrix and Ntfy setting
# for every script. This is done in arrays, where 'Override' is appended
# to the variable name, like this:
diff --git a/global-functions.rsc b/global-functions.rsc
index 70269c8..71aa7de 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -15,7 +15,7 @@
# Git commit id & info, expected configuration version
:global CommitId "unknown";
:global CommitInfo "unknown";
-:global ExpectedConfigVersion 136;
+:global ExpectedConfigVersion 137;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
@@ -1195,6 +1195,12 @@
:error true;
}
+ :if ([ :len ($ScriptInfo->"certificate") ] > 0) do={
+ :if ([ $CertificateAvailable ($ScriptInfo->"certificate") ] = false) do={
+ $LogPrint warning $0 ("Downloading certificate failed, trying without.");
+ }
+ }
+
:do {
:local BaseUrl [ $EitherOr ($ScriptInfo->"base-url") $ScriptUpdatesBaseUrl ];
:local UrlSuffix [ $EitherOr ($ScriptInfo->"url-suffix") $ScriptUpdatesUrlSuffix ];
diff --git a/mod/notification-gotify.rsc b/mod/notification-gotify.rsc
new file mode 100644
index 0000000..7070918
--- /dev/null
+++ b/mod/notification-gotify.rsc
@@ -0,0 +1,139 @@
+#!rsc by RouterOS
+# RouterOS script: mod/notification-gotify
+# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
+# Leonardo David Monteiro <leo@cub3.xyz>
+# https://rsc.eworm.de/COPYING.md
+#
+# requires RouterOS, version=7.15
+# requires device-mode, fetch, scheduler
+#
+# send notifications via Gotify (gotify.net)
+# https://rsc.eworm.de/doc/mod/notification-gotify.md
+
+:global FlushGotifyQueue;
+:global NotificationFunctions;
+:global PurgeGotifyQueue;
+:global SendGotify;
+:global SendGotify2;
+
+# flush Gotify queue
+:set FlushGotifyQueue do={ :do {
+ :global GotifyQueue;
+
+ :global IsFullyConnected;
+ :global LogPrint;
+
+ :if ([ $IsFullyConnected ] = false) do={
+ $LogPrint debug $0 ("System is not fully connected, not flushing.");
+ :return false;
+ }
+
+ :local AllDone true;
+ :local QueueLen [ :len $GotifyQueue ];
+
+ :if ([ :len [ /system/scheduler/find where name="_FlushGotifyQueue" ] ] > 0 && $QueueLen = 0) do={
+ $LogPrint warning $0 ("Flushing Gotify messages from scheduler, but queue is empty.");
+ }
+
+ :foreach Id,Message in=$GotifyQueue do={
+ :if ([ :typeof $Message ] = "array" ) do={
+ :do {
+ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \
+ http-header-field=($Message->"headers") http-data=[ :serialize to=json ($Message->"message") ] \
+ ($Message->"url") as-value;
+ :set ($GotifyQueue->$Id);
+ } on-error={
+ $LogPrint debug $0 ("Sending queued Gotify message failed.");
+ :set AllDone false;
+ }
+ }
+ }
+
+ :if ($AllDone = true && $QueueLen = [ :len $GotifyQueue ]) do={
+ /system/scheduler/remove [ find where name="_FlushGotifyQueue" ];
+ :set GotifyQueue;
+ }
+} on-error={
+ :global ExitError; $ExitError false $0;
+} }
+
+# send notification via Gotify - expects one array argument
+:set ($NotificationFunctions->"gotify") do={
+ :local Notification $1;
+
+ :global Identity;
+ :global IdentityExtra;
+ :global GotifyQueue;
+ :global GotifyServer;
+ :global GotifyServerOverride;
+ :global GotifyToken;
+ :global GotifyTokenOverride;
+
+ :global EitherOr;
+ :global FetchUserAgentStr;
+ :global IfThenElse;
+ :global LogPrint;
+ :global SymbolForNotification;
+
+ :local Server [ $EitherOr ($GotifyServerOverride->($Notification->"origin")) $GotifyServer ];
+ :local Token [ $EitherOr ($GotifyTokenOverride->($Notification->"origin")) $GotifyToken ];
+
+ :if ([ :len $Token ] = 0) do={
+ :return false;
+ }
+
+ :local Url ("https://" . $Server . "/message");
+ :local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ]; \
+ ("X-Gotify-Key: " . $Token); "Content-Type: application/json" });
+ :local Message ({
+ "title"=("[" . $IdentityExtra . $Identity . "] " . ($Notification->"subject")); \
+ "message"=(($Notification->"message") . "\n" . [ $IfThenElse ([ :len ($Notification->"link") ] > 0) \
+ ("\n" . [ $SymbolForNotification "link" ] . ($Notification->"link")) ]); \
+ "priority"=[ :tonum [ $IfThenElse ($Notification->"silent") 2 5 ] ] });
+
+ :do {
+ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \
+ http-header-field=$Headers http-data=[ :serialize to=json $Message ] $Url as-value;
+ } on-error={
+ $LogPrint info $0 ("Failed sending Gotify notification! Queuing...");
+
+ :if ([ :typeof $GotifyQueue ] = "nothing") do={
+ :set GotifyQueue ({});
+ }
+ :set ($Message->"message") (($Notification->"message") . "\n" . \
+ [ $SymbolForNotification "alarm-clock" ] . "This message was queued since " . \
+ [ /system/clock/get date ] . " " . [ /system/clock/get time ] . " and may be obsolete.");
+ :set ($GotifyQueue->[ :len $GotifyQueue ]) \
+ { url=$Url; headers=$Headers; message=$Message };
+ :if ([ :len [ /system/scheduler/find where name="_FlushGotifyQueue" ] ] = 0) do={
+ /system/scheduler/add name="_FlushGotifyQueue" interval=1m start-time=startup \
+ on-event=(":global FlushGotifyQueue; \$FlushGotifyQueue;");
+ }
+ }
+}
+
+# purge the Gotify queue
+:set PurgeGotifyQueue do={
+ :global GotifyQueue;
+
+ /system/scheduler/remove [ find where name="_FlushGotifyQueue" ];
+ :set GotifyQueue;
+}
+
+# send notification via Gotify - expects at least two string arguments
+:set SendGotify do={ :do {
+ :global SendGotify2;
+
+ $SendGotify2 ({ origin=$0; subject=$1; message=$2; link=$3; silent=$4 });
+} on-error={
+ :global ExitError; $ExitError false $0;
+} }
+
+# send notification via Gotify - expects one array argument
+:set SendGotify2 do={
+ :local Notification $1;
+
+ :global NotificationFunctions;
+
+ ($NotificationFunctions->"gotify") ("\$NotificationFunctions->\"gotify\"") $Notification;
+}
diff --git a/mod/notification-ntfy.rsc b/mod/notification-ntfy.rsc
index aac6d6c..2748c5b 100644
--- a/mod/notification-ntfy.rsc
+++ b/mod/notification-ntfy.rsc
@@ -18,7 +18,6 @@
# flush ntfy queue
:set FlushNtfyQueue do={ :do {
:global NtfyQueue;
- :global NtfyMessageIDs;
:global IsFullyConnected;
:global LogPrint;
diff --git a/news-and-changes.rsc b/news-and-changes.rsc
index 55b4165..a9a2904 100644
--- a/news-and-changes.rsc
+++ b/news-and-changes.rsc
@@ -61,6 +61,7 @@
134="Enhanced 'mod/notification-telegram' and 'telegram-chat' to support topics in groups.";
135="Introduced helper function '\$GetTelegramChatId' for 'mod/notification-telegram' which helps retrieve information.";
136="Introduced script 'check-perpetual-license' to check for license state on CHR.";
+ 137="Added support to send notifications via Gotify (gotify.net).";
};
# Migration steps to be applied on script updates