Remotely monitor IPsec state via ROS_Command

Dude V 6.38.5

I am attempting to remotely monitor the up/down state of a VPN using the following:

/ip ipsec installed-sa print count-only where dst-address=“XXX.XXX.XXX.XXX” and current-bytes=0

The above command seems to accurately parse all current Installed SAs and count the total connections with a specified destination IP and current bytes at 0.

The command runs fine from a terminal on a firewall, but when I attempt to create a Dude function (IPSec_State) out of it, using the ROS_Command option it throws an error unless I remove the quotes from around the IP Address as follows:

ros_command(“/ip ipsec installed-sa print count-only where dst-address=XXX.XXX.XXX.XXX and current-bytes=0”)

I then create a probe using the function as follows:

Name: IPsecState
Type: Function
Agent: default
Available: IPSec_State()=0
Error: if(IPSec_State()=0,“”,“down”)
Value: Null
Unit: bytes

I have never managed to get the probe to work even though the function isn’t reporting any syntax or parsing errors.

Try "xxx.xxx.xxx.xxx" for the IP address.
You can’t put " inside a quoted string without escaping it.