Code: Select all
/system script
add dont-require-permissions=no name=healthchecks policy=read,write,test source=":global healthchecksaddress \"healthchecks.io/ping/\";\
\n:local routerid \"e6dcad98-12b4-416b-a0d0-dca84f3aa98e\";\
\n:local printerid \"c4a36fdb-24ce-49e1-b038-c158fdeb8022\";\
\n:local tvid \"a8cd4b3a-fa83-494a-bd1b-f649265af614\";\
\n:local ruptime [/system resource get uptime];\
\n/tool fetch duration=10 output=none http-data=\"Uptime: \$ruptime\" http-method=post url=\"https://\$healthchecksaddress\$routerid\";\
\n:if ([/ping 192.168.0.191 count=1] = 1) do={/tool fetch duration=10 output=none http-method=post url=\"https://\$healthchecksaddress\$printerid\"};\
\n:if ([/ping 192.168.0.201 count=1] = 1) do={/tool fetch duration=10 output=none http-method=post url=\"https://\$healthchecksaddress\$tvid\"};\
\n"
/system scheduler
add interval=5m name=healthchecks on-event=healthchecks policy=read,write,test
This is just an example (ids are random) and you need to create your own checks in Healthchecks (setup schedule and integrations) and set up proper variables in script.
It's just "working concept" and I'd appreciate any ideas how to improve it (eg. make an array: ips → healthchecks uris), or any other fancy ideas what and how to monitor with it. . If you use it with your Mikrotiks pls. share your configs or ideas here.