I'm working on a script that uses ping to check if a remote host is up. Its not working. I've found several similar examples on this forum that use ping in scripts for various things; I've loaded several of those scripts just to see if they work -- they don't.
It may be that something has changed in current RouterOS that breaks all of these?
Can someone look at my below test output and tell me why it might not work. Any thoughts would be appreciated.
-J
[admin@MikroTik] >
[admin@MikroTik] >
[admin@MikroTik] > /system/script/print from=test
Flags: I - invalid
0 name="test" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon dont-require-permissions=yes last-started=mar/29/2022 18:36:41 run-count=14
source=
:if ([:ping 8.8.8.8 count=2 interval=90ms]!=2) do={:put "failed"}
**** Since 8.8.8.8 is reachable, I expect to not see the word "failed" appear when this above script is run ****
[admin@MikroTik] > /system/script/run test
Columns: SEQ, HOST, SIZE, TTL, TIME
SEQ HOST SIZE TTL TIME
0 8.8.8.8 56 117 15ms691us
1 8.8.8.8 56 117 22ms882us
failed
**** However, I do see the word failed.. even though console output clearly shows there were two responses ****
[admin@MikroTik] > :put [:ping 8.8.8.8 count=2]
Columns: SEQ, HOST, SIZE, TTL, TIME
SEQ HOST SIZE TTL TIME
0 8.8.8.8 56 117 18ms205us
1 8.8.8.8 56 117 14ms166us
**** here I try it manually on the console... there are two ping responses but no result output of the ping invocation, seemingly ****
*** below are details of my hardware and OS versions ***
[admin@MikroTik] > /system/routerboard/print
routerboard: yes
model: CCR1009-7G-1C-1S+
serial-number: 915008B5E749
firmware-type: tilegx
factory-firmware: 3.41
current-firmware: 7.1.5
upgrade-firmware: 7.1.5
[admin@MikroTik] > /system/package/print
Columns: NAME, VERSION
# NAME VERSION
0 iot 7.1.5
1 routeros 7.1.5
[admin@MikroTik] >
[admin@MikroTik] >