Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions snmp-ipsec-ph2-probe
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# The simple script gives results of 0 or 1 after asking by SNMP (Script checks if phase 2 established with an SA Destination Address)
# Do not forget to use /32 on single IP
# Don't use a netmask when defining $remoteIP, otherwise the script won't work.

:local sadstip XXX.XXX.XXX.XXX/32
:local remoteIP "XXX.XXX.XXX.XXX"

if ([/ip ipsec policy get value-name=ph2-state [find sa-dst-address=$sadstip]] = "established") do={
:if ([:len [/ip ipsec active-peers find where remote-address=$remoteIP and state="established"]] > 0) do={
:put 1
} else= {
} else={
:put 0
}