local peer [ip ipsec remote-peers get value-name=remote-address number=0]
:log info $peer
It should get ip address of remote peer and make a log, when i run it from the winbox or schedule, it makes a blank log, but when i run the same script from the CLI it logs well.
I noticed thet when i reload router and run script from winbox it works well, but when i flush ipsec peers and reconnect, the script does the same.
rdc
I tried different versions, tried with :local, but result is the same.
tomaskir
doesn’t worked for me
Result is: "Peer 0 - " when run from winbox or schedule, but works when run from CLI.
when i reload router it works, but when i flush peers and reestablish it still does the same
I don’t understand, is it a bug or what?
Actually, it has to do with using 0 as the identifier.
This should work always, and will return all pears as an array $peer. I use a simply :foreach to write them out.
:local peer [/ip ipsec remote-peers get [/ip ipsec remote-peers find] remote-address]
:foreach i in $peer do={
:log info "Peer - $i"
}
Thanks for your help, but it worked when there was a single tunnel (remote peer), but with more than one peer, it generates error: “invalid internal item number”, in both winbox and command line.
I think that command
[/ip ipsec remote-peers get [/ip ipsec remote-peers find ] remote-address]
doesn’t return an array value.
I’m week at scripting, but i need to check which tunnels are connected