eworm-de / routeros-scripts Goto Github PK
View Code? Open in Web Editor NEWa collection of scripts for MikroTik RouterOS
License: GNU General Public License v3.0
a collection of scripts for MikroTik RouterOS
License: GNU General Public License v3.0
Scripts lack the ability to exponentiation operations and file moves.
Hope you can achieve it.
Sending a notification via Telegram containing a warning sign results in a black and white emoji.
I'm using github as a base url to pull updates and thus don't need Let's Encrypt cert. Please consider making certificate name that your script expects customizable.
With this script, the router should restart after 1 minute if autoupgrade is switched on and an upgrade is available, right? Because nothing happens to me.
If the size of the IP list in the URL for the fw-addr-lists list is larger than 64k, it cannot download all of it. It can download the first 64k size. Can you do a looped download in parts for this, @eworm-de?
For example, can you download the entire content in parts like this with a loop?
:tool fetch url=$url http-header-field="Range: bytes=$start-$end" output=user defined
Hello,
I would like to request 2 features for the dhcp-to-dns script.
Thank you
That is great set of scripts, appreciate to all of your works .
The script contains a folder to organize backup file(s) . That is good idea but there are minor issue that is attached file contains the folder name.
it is my person modification with daily backup and monthly backup, it will keep monthly and current date backup.
#Add type of backup
:local TypeOfBackup "";
:local mday [:pick $YYYYMMDD 6 8];
:if ($mday = "01") do={
set $TypeOfBackup ("Monthly")
} else= {
set $TypeOfBackup ("Daily")
}
#Remove Outdate Backup file
/ file remove [ /file find where name~"^$0/..-$TypeOfBackup-.$"]
#Rewrite File with date & time pattern
:local FileName ([ $CharacterReplace ($Identity . "." . $Domain) "." "_"]."-".$TypeOfBackup."-". $YYYYMMDD . "-". $HHMMSS );
#Rewrite Subject Line with date & time pattern
subject=([ $SymbolForNotification "floppy-disk,incoming-envelope" ] .
"Backup & Config"." ".$TypeOfBackup." ". $YYYYMMDD . " [" . [/system clock get time] . "]"); \
Tested on RouterOS v7.1b6 Example prefix: 2001:7d0:87cc:c600::/56
Hi,
first of all, Thank You for such a great library of script. I'm using at home this for forwarding my SMS to Telegram. It was working ok, but it suddenly stopped. I have tried to update script, but I have same error in logs:
I have noticed, that in script is used
/ tool fetch check-certificate=yes-without-crl keep-result=no
but according to RouterOS, it is deprecated parameter
This is my setup:
[rch@mikrotik] /system identity> /system routerboard print
routerboard: yes
board-name: hAP ac^2
model: RBD52G-5HacD2HnD
serial-number: xxxxxxxxxxxx
firmware-type: ipq4000L
factory-firmware: 6.42.3
current-firmware: 6.44.3
upgrade-firmware: 6.46.2
Could you please modify script to work with 6.46.x version ?
Thank You
Hello everybody,
people start to contribute scripts, but I am not interested in using all of them, or even missing hardware to do so. Merging them here is a bad trade off for both of use, the contributor and me: Issues are opened here, the contributor does not recognize (without me forwarding them). On the other hand all changes would have to be reviewed and merged by me, mostly without testing.
To mitigate that situation I think about adding a new section Foreign scripts & modules to the main README, just below Installing custom scripts & modules. You could add links to your website or repository with the scripts, and link back to my repository for general information, base installation and other scripts.
Any comments on this? I would like some feedback from @zainarbani (for #22) and @bubenkoff (#31 & #32). Do you think this is a reasonable solution for you?
Is this something to worry? thanks
Hello ,
I want to know how to use the scripts with Netwatch ?
I mean should I write the script ? there are no free scripts ?
I mean I want to have a script to send me a message where any GRE Tunnel is down for 1 second ?
I really need your help
Best Regards
I have used a similar script to dhcp-to-dns
for assigning static DNS records to IPv4 addresses and previously modified it to also generate records for IPv6 addresses based on DHCPv4 leases' MAC address and IPv6 Neighbor List entries. I haven't thought about it much before, so there might be some scenario where this kind of solution misbehaves. Nevertheless, I believe we deserve some way to implement DNS auto-configuration for IPv6 as well...
Is this feature wanted or is the dhcp-to-dns
script considered feature-complete? Would perhaps a separate script implementing this feature be welcomed or does this feel too hacky?
There are some issue in version 55. $SendEMail2 functions is unable to send out email in email-backup. will it be carry attachment issue in that function? Meanwhile $SendNotification2 can send out telegram , matrix and email.
My version is 6.48.3
Email Backup file is created but no email sent out
$DownloadPackage failed to connect and pull packages. Issue is at line 261 in the global-functions.
The line reads:
:local PkgFile ($PkgName . "-" . $PkgVer . "-" . $PkgArch . ".npk");
Corrected line:
:local PkgFile ($PkgName . "-" . $PkgArch . "-" . $PkgVer . ".npk");
Hi, first thank you for all your hard work on this. I am a bit of a ROS newbie so please bear with me.
I installed the dhcp-to-dns script and am using a simple private internal .lan for my domain name. I would like the static DNS record to be hostname.lan. Instead I am getting hostname.dhcp.lan. I have the HostNameInZone configured to false, hopefully that is correct. Any way to have this appear simply as hostname.lan?
Also - I am unclear why there is the global-config overlay VS just global-config. Which one takes precedent? Does one update the other?
Thanks in advance and sorry of the layman questions.
$SendNotification or $SendTelegram is working properly if invoke in the terminal of mikrotik but calling it inside the script did nothng
Hello, question, any plans for OpenVPN 2 DNS script?
Hallo Christian,
Hast du eine Anleitung wie genau man die Scripte einbinden etc muss. Probiere gerade seit 2 Tage das z.B SMS Befehls Script zum laufen zu bekommen.
sG
i have a very simple monitor via netwatch
preface:
i have notification enabled via mail, ntfy and telegram.
via terminal, if i do a simple
$SendNotification "test" "test"
everything works !
on a Netwatch monitor i have set for UP:
:global SendNotification
$SendNotification "Test" "Up";
for DOWN:
:global SendNotification
$SendNotification "Test" "Down";
but on netwatch it doesn't work.
tested by logging something, and it works fine.
any suggestions on why it happens ?
In the check-routeros-update script's docs, it's suggested to use the 'startup' time of the script to be scheduled.
For such actions, it seems more logical to schedule it at night instead, as the update shouldn't normally happen in the busy time.
Hi,
Again - thank you for all of this - I am leaning much about how scripting works and I sincerely thank you.
If this is not the best way to ask questions, as these are not code issues necessarily, please let me know.
Questions - I am looking through this and trying to understand the "several" checks aspect of this script. If I understand correctly the default if =>5? So if the time out is 5s then it would roughly check for a period of 25 seconds before initiating the email?
Also - if I was going to turn an interface on/off or enable/disable a firewall rule would I add them as I have below in my example as SET CUSTOM ACTIONS HERE?
:if ($Metric->"count" >= 5 && $Metric->"notified" != true) do={
$SendNotification ("Netwatch Notify: \E2\9D\8C " . $HostName . " down") \
("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".");
:set ($Metric->"notified") true;
**SET CUSTOM ACTIONS HERE**
}
Many thanks again.
Hi,
This is a suggestion, would it be possible to add html support to the notification telegram bot in the future? Now it is only possible to send in markdown format and forcing the body to be in a code box.
Greetings
I have a local device which has a http endpoint flag ie: "http://10.200.191.200/works/"
When there is no response or the response is "disabled" then the device is down.
The device is expecting "load" more the 1 request per second and the response should not take more then 3 seconds.
Can you please write an example check for this use case?
Instead of properly differentiating between different DHCP network domains and assigning different records for different leases with same MAC addresses, the script ignores other addresses. This feature is particularly useful when using multiple VLANs on devices.
#49 is also affected by this.
Safari not support AVIF
https://avif.io/blog/tutorials/safari/#safariavifsupportsoon
I have only those settings in the config:
:global LogForwardIncludeMessage "(olha)";
But still get such messages forwarded for some reason:
The log on LTE contains these 2 messages after 2d18:32:21 uptime.
๐ด๏ธ 06:50:44 ipsec;error phase1 negotiation failed due to time up 33[500]<=>33[37672] d8757bb7945e3880:f23e9a07bac4fbdc
๐ด๏ธ 06:50:45 ipsec;error phase1 negotiation failed due to time up 33[500]<=>323[14651] 1a32d74bb499f6f1:e997e28f4652eccf
The expected messages are also passed, but just some additional non-expected messages also do pass.
Can you please help me understand what I missed in the configuration, or is it a bug?
Forward slashes for elements inside RouterOS are deprecated. For example: /system/routerboard/print
no longer functions, the proper syntax is now /system routerboard print
for this reason, the entire script system is unusable on ROS v6.49.7
Hi, first thank you for all your hard work on this.
I use this script, but every time it runs, the processor is 100% utilized. Tried to run from the console, the script runs for 20-30 seconds. There are no more than 10 reservations in dhcp.
Also, on the firewall, I redirect all traffic on port 53 from the local network to the router itself.
So I use DoH (adguard).
What could be the reason for the high utilization rate?
Hello,
If i try to trun "/ system script run email-backup" i get the error "Error sending email [xxx] Backup & Config>:invalid BODY; I seems that there is a problem with the file.
Im using version 6.44.5 and 6.45.1. Sending a test mail over the menu is working fine.
Thanks a lot for your work
It would be nice if the script would pull the domain from "/ip/dhcp-server/network" using the appropriate "domain" value.
Good day, Is there a way or workaround calling sendNotification inside netwatch?
Hello, is there any nice solution on how to use "active address" instead of address? I have a bunch of leases where the address is a pool and of course, the script will crash on it because dhcp_pool0 is not valid ipv4 or ipv6. thx for the response.
Hello !
can you provide a way to specify username and password for ntfy ?
fetch can accomodate user, pass for that.
some private ntfy instances (self-hosted) can be secured by that
thanks
On the netwatch notify Is it possible to use the count for wan-up as well as wan-down? (or have a separate count for WAN-Up)
Ideally I'd like the wan to pass a certain number of checks before it's brought back into use to deal with a link that's not completely dead but has high levels of packetloss. (E.g a wireless link in bad weather)
When running /system/script/run packages-update;
I can no longer schedule a reboot over night.
Output of Terminal:
/system/script/run packages-update;
info: Package file routeros already exists.
info: Running backup script backup-cloud before update.
status: finished
info: Rebooting for update.
Reboot, yes? [y/N]:
N
action cancelled
RouterOS Version 7.9
Hello,
Just discovered your Mikrotik script repo and it looks really nice !
Can you just elaborate on this :
:global ScriptUpdatesIgnore {
"global-config"
}
Why is this file not updated on script-update ? How are we supposed to change the destination address for mail backup ?
Thanks a lot for your work
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.