help probe netwatch

Hello,
i want to monitor a mikrotik load balancer (pcc) with ip on wan natted.

so i can’t monitor from outside mikrotik.

i can monitor mikrotik 4011 from a remote chr on datacenter with VPN.
works all fine, but i want to check if a wan is down

so, if a run on terminal in 4011

:put ([:pick [/tool netwatch print as-value where comment="MONITOR - WAN1"] 0]->"status");

result is up or down

i try to integrate this ros command in dude to monitor if a wan is down

so i create a function
name: mikrotik_netwatch_wan1
code:

ros_command(":put ([:pick [/tool netwatch print as-value where comment=\"MONITOR WAN1\"] 0]->\"status\");")

i used \ to escape double quotes

create probes
name: mikrotik_netwatch_wan1
type: function
agent: default

available : 1=1
error : if(mikrotik_netwatch_wan1()=up, “”, “down”)

value: mikrotik_netwatch_wan1()

unit: [empty]

but when i add this probe to device i have “parse failed”

some can help to improve this monitoring?

thank you in advance

i think parse failed is a problem in functions.
so i try also

if (ros_command(":put ([:pick [/tool netwatch print as-value where comment=\"MONITOR WAN1\"] 0]->\"status\");")) = "up", "", "down")

but i have same problem “parse failed”
i try also with host

if (ros_command(":put ([:pick [/tool netwatch print as-value where host=8.8.8.8] 0]->\"status\");")) = "up", "", "down")

thank you

Simply count parenthesys outside put string?
2 (
3 )

if ( ros_command(":put ([/tool netwatch print as-value where comment=\"MONITOR WAN1\"]->0->\"status\")") = "up", "", "down" )

thank you for reply.
i check on mikrotik and yes , your code is more clean and works :slight_smile:

but when i change on dude i receive always “parse failed”

maybe error is on probe???

name: mikrotik_netwatch_wan1
type: function
agent: default

available : 1=1
error : if(mikrotik_netwatch_wan1()=up, “”, “down”)
value: mikrotik_netwatch_wan1()
unit: [empty]

i tried also
error : if(mikrotik_netwatch_wan1()==up, “”, “down”)

thank you again

i check another way , and change function like this

ros_command(":put ([/tool netwatch print as-value where comment=\"MONITOR WAN1\"]->0->\"status\")")

i add it in appearance and i show correct : up

so now i’m sure problem is on probe

i create probe
available: 1
error: if(mikrotik_function_netwatch_wan1()==up, “”, “down”)
value: mikrotik_function_netwatch_wan1()

also
error: if(mikrotik_function_netwatch_wan1()=up, “”, “down”)

parse error

nothing, i try many code but with the dude i have always same error…

to reader, i resolve with zabbix…
i monitor netwatch with zabbix and ssh agent (of course i need to enable and expose ssh port, but i open only from my zabbix ip)

thank you for reply.

ps. @rextended , can i contact you in private?
i need some help with a request of my customer and i’m searching a professional help (payment of course)

thank you