mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-21 19:34:41 +02:00
Merge branch 'doc/mod' into next
This commit is contained in:
commit
343ee27820
27 changed files with 274 additions and 15 deletions
|
@ -224,6 +224,11 @@ Available modules
|
||||||
|
|
||||||
* [Manage ports in bridge](doc/mod/bridge-port-to.md)
|
* [Manage ports in bridge](doc/mod/bridge-port-to.md)
|
||||||
* [Manage VLANs on bridge ports](doc/mod/bridge-port-vlan.md)
|
* [Manage VLANs on bridge ports](doc/mod/bridge-port-vlan.md)
|
||||||
|
* [Inspect variables](doc/mod/inspectvar.md)
|
||||||
|
* [IP address calculation](doc/mod/ipcalc.md)
|
||||||
|
* [Send notifications via Matrix](doc/mod/notification-matrix.md)
|
||||||
|
* [Send notifications via Telegram](doc/mod/notification-telegram.md)
|
||||||
|
* [Download script and run it once](doc/mod/scriptrunonce.md)
|
||||||
|
|
||||||
Contact
|
Contact
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -30,7 +30,9 @@ The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
* `BackupPassword`: password to encrypt the backup with
|
* `BackupPassword`: password to encrypt the backup with
|
||||||
* `BackupRandomDelay`: delay up to amount of seconds when run from scheduler
|
* `BackupRandomDelay`: delay up to amount of seconds when run from scheduler
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
Usage and invocation
|
Usage and invocation
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -36,7 +36,9 @@ The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
* `BackupUploadUser`: username for server authentication
|
* `BackupUploadUser`: username for server authentication
|
||||||
* `BackupUploadPass`: password for server authentication
|
* `BackupUploadPass`: password for server authentication
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
### Issues with SFTP client
|
### Issues with SFTP client
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
The expiry notifications just require notification settings for e-mail,
|
The expiry notifications just require notification settings for e-mail,
|
||||||
matrix and/or telegram.
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
For automatic download and renewal of certificates you need configuration
|
For automatic download and renewal of certificates you need configuration
|
||||||
in `global-config-overlay`, these are the parameters:
|
in `global-config-overlay`, these are the parameters:
|
||||||
|
|
|
@ -56,7 +56,9 @@ The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
* `CheckHealthVoltageLow`: value (in volt*10) giving a hard lower limit
|
* `CheckHealthVoltageLow`: value (in volt*10) giving a hard lower limit
|
||||||
* `CheckHealthVoltagePercent`: percentage value to trigger voltage jumps
|
* `CheckHealthVoltagePercent`: percentage value to trigger voltage jumps
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
---
|
---
|
||||||
[◀ Go back to main README](../README.md)
|
[◀ Go back to main README](../README.md)
|
||||||
|
|
|
@ -35,7 +35,9 @@ Just install the script:
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Notification setting are required for e-mail, matrix and/or telegram.
|
Notification setting are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
See also
|
See also
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -47,7 +47,9 @@ safe versions from a web server. The configuration goes to
|
||||||
* `SafeUpdateUrl`: url to check for safe update, the channel (`long-term`,
|
* `SafeUpdateUrl`: url to check for safe update, the channel (`long-term`,
|
||||||
`stable` or `testing`) is appended
|
`stable` or `testing`) is appended
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
Usage and invocation
|
Usage and invocation
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -40,7 +40,9 @@ On first run a disabled access list entry acting as marker (with comment
|
||||||
"`--- collected above ---`") is added. Move this entry to define where new
|
"`--- collected above ---`") is added. Move this entry to define where new
|
||||||
entries are to be added.
|
entries are to be added.
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
Usage and invocation
|
Usage and invocation
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -51,7 +51,9 @@ Then add an access list entry:
|
||||||
|
|
||||||
/ interface wireless access-list add comment="Daily PSK" interface=wl-daily private-pre-shared-key="ToBeChangedDaily";
|
/ interface wireless access-list add comment="Daily PSK" interface=wl-daily private-pre-shared-key="ToBeChangedDaily";
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
---
|
---
|
||||||
[◀ Go back to main README](../README.md)
|
[◀ Go back to main README](../README.md)
|
||||||
|
|
|
@ -46,7 +46,9 @@ The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
* `LogForwardIncludeMessage`: define message text to be forwarded (even if
|
* `LogForwardIncludeMessage`: define message text to be forwarded (even if
|
||||||
filter matches)
|
filter matches)
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md)m.
|
||||||
|
|
||||||
---
|
---
|
||||||
[◀ Go back to main README](../README.md)
|
[◀ Go back to main README](../README.md)
|
||||||
|
|
BIN
doc/mod/inspectvar.d/inspectvar.avif
Normal file
BIN
doc/mod/inspectvar.d/inspectvar.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
33
doc/mod/inspectvar.md
Normal file
33
doc/mod/inspectvar.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
Inspect variables
|
||||||
|
=================
|
||||||
|
|
||||||
|
[◀ 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
|
||||||
|
-----------
|
||||||
|
|
||||||
|
RouterOS handles not just scalar variables, but also arrays - even nested.
|
||||||
|
This module adds a function to inspect variables.
|
||||||
|
|
||||||
|
Requirements and installation
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Just install the module:
|
||||||
|
|
||||||
|
$ScriptInstallUpdate mod/inspectvar;
|
||||||
|
|
||||||
|
Usage and invocation
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Call the function `$InspectVar` with a variable as parameter:
|
||||||
|
|
||||||
|
$InspectVar $ModeButton
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
[◀ Go back to main README](../../README.md)
|
||||||
|
[▲ Go back to top](#top)
|
BIN
doc/mod/ipcalc.d/ipcalc.avif
Normal file
BIN
doc/mod/ipcalc.d/ipcalc.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
doc/mod/ipcalc.d/ipcalcreturn.avif
Normal file
BIN
doc/mod/ipcalc.d/ipcalcreturn.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
53
doc/mod/ipcalc.md
Normal file
53
doc/mod/ipcalc.md
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
IP address calculation
|
||||||
|
======================
|
||||||
|
|
||||||
|
[◀ 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 functions for IP address calculation.
|
||||||
|
|
||||||
|
Requirements and installation
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Just install the module:
|
||||||
|
|
||||||
|
$ScriptInstallUpdate mod/ipcalc;
|
||||||
|
|
||||||
|
Usage and invocation
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
### IPCalc
|
||||||
|
|
||||||
|
The function `$IPCalc` prints information to terminal, including:
|
||||||
|
|
||||||
|
* address
|
||||||
|
* netmask
|
||||||
|
* network in CIDR notation
|
||||||
|
* minimum host address
|
||||||
|
* maximum host address
|
||||||
|
* broadcast address
|
||||||
|
|
||||||
|
It expects an IP address in CIDR notation as argument.
|
||||||
|
|
||||||
|
$IPCalc 192.168.88.1/24;
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### IPCalcReturn
|
||||||
|
|
||||||
|
The function `$IPCalcReturn` expects an IP address in CIDR notation as
|
||||||
|
argument as well. But it does not print to terminal, instead it returns
|
||||||
|
the information in a named array.
|
||||||
|
|
||||||
|
:put ([ $IPCalcReturn 192.168.88.1/24 ]->"broadcast");
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
[◀ Go back to main README](../../README.md)
|
||||||
|
[▲ Go back to top](#top)
|
45
doc/mod/notification-matrix.md
Normal file
45
doc/mod/notification-matrix.md
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
Send notifications via Matrix
|
||||||
|
=============================
|
||||||
|
|
||||||
|
[◀ 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
|
||||||
|
[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
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Just install the module:
|
||||||
|
|
||||||
|
$ScriptInstallUpdate mod/notification-matrix;
|
||||||
|
|
||||||
|
Also install a Matrix client on at least one of your mobile and/or desktop
|
||||||
|
devices and create an account.
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Edit `global-config-overlay`, add `MatrixHomeServer`, `MatrixAccessToken` and
|
||||||
|
`MatrixRoom`. Then reload the configuration.
|
||||||
|
|
||||||
|
Usage and invocation
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
There's nothing special to do. Every script or function sending a notification
|
||||||
|
will now send it to your Matrix account.
|
||||||
|
|
||||||
|
See also
|
||||||
|
--------
|
||||||
|
|
||||||
|
* [Send notifications via Telegram](notification-telegram.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
[◀ Go back to main README](../../README.md)
|
||||||
|
[▲ Go back to top](#top)
|
BIN
doc/mod/notification-telegram.d/newbot.avif
Normal file
BIN
doc/mod/notification-telegram.d/newbot.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
63
doc/mod/notification-telegram.md
Normal file
63
doc/mod/notification-telegram.md
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
Send notifications via Telegram
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[◀ 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
|
||||||
|
[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
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Just install the module:
|
||||||
|
|
||||||
|
$ScriptInstallUpdate mod/notification-telegram;
|
||||||
|
|
||||||
|
Also install Telegram on at least one of your mobile and/or desktop devices
|
||||||
|
and create an account.
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Open Telegram, then start a chat with [BotFather](https://t.me/BotFather) and
|
||||||
|
create your own bot:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Now open a chat with your bot and start it by clicking the `START` button.
|
||||||
|
|
||||||
|
Open just another chat with [GetIDs Bot](https://t.me/getidsbot), again start
|
||||||
|
with the `START` button. It will send you some information, including the
|
||||||
|
`id`, just below `You`.
|
||||||
|
|
||||||
|
Finally edit `global-config-overlay`, add `TelegramTokenId` with the token
|
||||||
|
from *BotFather* and `TelegramChatId` with your id from *GetIDs Bot*. Then
|
||||||
|
reload the configuration.
|
||||||
|
|
||||||
|
### Notifications to a group
|
||||||
|
|
||||||
|
Sending notifications to a group is possible as well. Add your bot and the
|
||||||
|
*GetIDs Bot* to a group, then use the group's id (which starts with a dash)
|
||||||
|
for `TelegramChatId`. Then remove *GetIDs Bot* from group.
|
||||||
|
|
||||||
|
Usage and invocation
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
There's nothing special to do. Every script or function sending a notification
|
||||||
|
will now send it to your Telegram account.
|
||||||
|
|
||||||
|
See also
|
||||||
|
--------
|
||||||
|
|
||||||
|
* [Send notifications via Matrix](notification-matrix.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
[◀ Go back to main README](../../README.md)
|
||||||
|
[▲ Go back to top](#top)
|
3
doc/mod/scriptrunonce.d/hello-world.rsc
Normal file
3
doc/mod/scriptrunonce.d/hello-world.rsc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!rsc by RouterOS
|
||||||
|
|
||||||
|
:put ("Hello World from " . [ / system identity get name ] . "!");
|
BIN
doc/mod/scriptrunonce.d/scriptrunonce.avif
Normal file
BIN
doc/mod/scriptrunonce.d/scriptrunonce.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
35
doc/mod/scriptrunonce.md
Normal file
35
doc/mod/scriptrunonce.md
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
Download script and run it once
|
||||||
|
===============================
|
||||||
|
|
||||||
|
[◀ 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 a function that downloads a script, checks for syntax
|
||||||
|
validity and runs it once.
|
||||||
|
|
||||||
|
Requirements and installation
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Just install the module:
|
||||||
|
|
||||||
|
$ScriptInstallUpdate mod/scriptrunonce;
|
||||||
|
|
||||||
|
Usage and invocation
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The function `$ScriptRunOnce` expects an url pointing to a script as parameter.
|
||||||
|
|
||||||
|
$ScriptRunOnce https://git.eworm.de/cgit/routeros-scripts/plain/doc/mod/scriptrunonce.d/hello-world.rsc
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Giving multiple scripts is possible, separated by comma.
|
||||||
|
|
||||||
|
---
|
||||||
|
[◀ Go back to main README](../../README.md)
|
||||||
|
[▲ Go back to top](#top)
|
|
@ -88,7 +88,9 @@ powered off, but accessibility is of interest.
|
||||||
|
|
||||||
Go and get your coffee ☕️ before sending the print job.
|
Go and get your coffee ☕️ before sending the print job.
|
||||||
|
|
||||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
Also notification settings are required for e-mail,
|
||||||
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md).
|
||||||
|
|
||||||
Tips & Tricks
|
Tips & Tricks
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -31,8 +31,10 @@ Just install the script:
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Notification settings are required for e-mail, matrix and/or telegram. Also
|
Notification settings are required for e-mail,
|
||||||
you have to enable receiving of SMS:
|
[matrix](mod/notification-matrix.md) and/or
|
||||||
|
[telegram](mod/notification-telegram.md). Also you have to enable receiving
|
||||||
|
of SMS:
|
||||||
|
|
||||||
/ tool sms set receive-enabled=yes;
|
/ tool sms set receive-enabled=yes;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
:global GlobalConfigVersion 77;
|
:global GlobalConfigVersion 78;
|
||||||
|
|
||||||
# This is used for DNS and backup file.
|
# This is used for DNS and backup file.
|
||||||
:global Domain "example.com";
|
:global Domain "example.com";
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
# Comment or remove to disable news and change notifications.
|
# Comment or remove to disable news and change notifications.
|
||||||
:global GlobalConfigVersion 77;
|
:global GlobalConfigVersion 78;
|
||||||
|
|
||||||
# Copy configuration from global-config here and modify it.
|
# Copy configuration from global-config here and modify it.
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
("Still running RouterOS v6, so last reminder to see https://git.eworm.de/cgit/routeros-scripts/about/#changes-for-routeros-v6") ]);
|
("Still running RouterOS v6, so last reminder to see https://git.eworm.de/cgit/routeros-scripts/about/#changes-for-routeros-v6") ]);
|
||||||
76="Added an option to suppress notifications on host down with 'netwatch-notify'.";
|
76="Added an option to suppress notifications on host down with 'netwatch-notify'.";
|
||||||
77="Introduced new script 'firmware-upgrade-reboot'. Handle with care!";
|
77="Introduced new script 'firmware-upgrade-reboot'. Handle with care!";
|
||||||
|
78="New documentation is online for notifications via Telegram & Matrix, variable inspection, ip address calculation and running scripts once.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Migration steps to be applied on script updates
|
# Migration steps to be applied on script updates
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||||
|
|
||||||
# expected configuration version
|
# expected configuration version
|
||||||
:global ExpectedConfigVersion 77;
|
:global ExpectedConfigVersion 78;
|
||||||
|
|
||||||
# global variables not to be changed by user
|
# global variables not to be changed by user
|
||||||
:global GlobalFunctionsReady false;
|
:global GlobalFunctionsReady false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue