Community discussions

MikroTik App
 
lucapsg
just joined
Topic Author
Posts: 15
Joined: Tue Jan 30, 2018 8:37 pm

Get "root bridge ID" from devices

Mon Jul 12, 2021 7:47 pm

I need to monitor the RSTP status of some devices and to do that I would need to know the current "root bridge id" of each.
I saw that the command
/interface bridge monitor bridge once 
includes this information but how do I just extract the single line and store it in a variable?
Thank you.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Get "root bridge ID" from devices

Mon Jul 12, 2021 7:52 pm

nominated "bridge1"
:global bridge1id ([/interface bridge monitor bridge1 once as-value ]->"root-bridge-id")
:put $bridge1id

function
:global getid do={:return ([/interface bridge monitor $1 once as-value ]->"root-bridge-id")}
:global bridge1id [$getid bridge1]
:put $bridge1id

all
/interface bridge
    :foreach idx in=[find] do={
        :put ([monitor $idx once as-value ]->"root-bridge-id")
    }
Last edited by rextended on Mon Jul 12, 2021 8:11 pm, edited 3 times in total.
 
lucapsg
just joined
Topic Author
Posts: 15
Joined: Tue Jan 30, 2018 8:37 pm

Re: Get "root bridge ID" from devices

Mon Jul 12, 2021 8:08 pm

Wow, rapid and exhaustive!
I did not know this syntax.
Thank you / Grazie.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Get "root bridge ID" from devices

Mon Jul 12, 2021 8:10 pm

IT: ho modificato il post precedente per fare meglio quello che hai chiesto ho dimenticato "and store it in a variable"

EN: I edited the previous post to do better what you asked for, I miss "and store it in a variable"

Who is online

Users browsing this forum: 5h4k4, Bing [Bot], johnb175a, k6ccc, smirgo and 78 guests