I came across an issue in our country where mobile internet access went down for a couple of hours and some of my Chateaus did not re-register on carrier and they needed LTE restart.
I wanted a method to check at least 3 hosts before issuing LTE restart, so i created and share this handy script. (Works on rOS 7.5<)
Code: Select all
/tool netwatch
add comment=STAGE-1 disabled=no down-script=":log info \"Activating Stage-2\";\r\
\n/tool/netwatch enable [find comment=STAGE-2];\r\
\n" host=208.67.222.222 http-codes="" interval=30s packet-count=4 \
packet-interval=5s test-script=":log info testing" thr-avg=500ms type=icmp \
up-script=":log info \"DISABLING\";\r\
\n/tool/netwatch disable [find comment=STAGE-2];\r\
\n"
add comment=STAGE-2 disabled=yes down-script=":log info \"Activating FINAL Stage\
-3\";\r\
\n/tool/netwatch enable [find comment=STAGE-3];\r\
\n" host=217.160.0.25 http-codes="" packet-count=5 packet-interval=5s \
test-script=":log info \"STAGE-2 CHECK...\"" thr-avg=500ms type=icmp \
up-script=":log info \"DISABLING\";\r\
\n/tool/netwatch disable [find comment=STAGE-2];\r\
\n/tool/netwatch disable [find comment=STAGE-3];\r\
\n"
add comment=STAGE-3 disabled=yes down-script=":log info \"FINAL STAGE ACTIVATED\
\"\r\
\n/int lte disable 0;\r\
\n:delay 2s;\r\
\n/int lte enable 0;" host=62.103.129.253 http-codes="" packet-count=5 \
packet-interval=5s test-script=":log info \"STAGE-3 CHECK...\"" thr-avg=\
500ms type=icmp up-script=":log info \"DISABLING\";\r\
\n/tool/netwatch disable [find comment=STAGE-2];\r\
\n/tool/netwatch disable [find comment=STAGE-3];"
If host2 is up, then it disables itself(STAGE-2 and further STAGE-3).
If host2 is down, it activates STAGE-3, final host.
If host3 is down, then it issues the LTE disable/enable.
If host3 is up, then it disables itself and previous STAGE-2, reverting to STAGE-1.