Community discussions

MikroTik App
 
Strauch
just joined
Topic Author
Posts: 2
Joined: Thu Mar 11, 2021 4:10 pm

Problems reading values out of the registration-table

Fri Mar 12, 2021 9:33 am

Hi,
i´ve got some problems to read values out of the /interface wireless registration-table print stats.

I use a flexible mesh network where participans leave an return. When I restart the router and starts the script the first time, I gote the values I want, but if a participant or all participants leave and return, the script didn´t work. It manifests itself in the fact that the values are no longer output to the variables. If I use the command in the terminal, it also does not work.

The script should be used to read TX/RX and the traffic of a connection, if it is stable and fetch the values to a server to evaluate them.

I hope someone can help me with this problem.

Best greetings
Strauch
{
:global TX;
:local RX;
:local CPULoad;
:local ID 1;
:local name;
:global total;

:set $RX [/interface wireless registration-table get number=$ID signal-strength]
:set $TX  [/interface wireless registration-table get number=$ID tx-signal-strength]
:set $name [/interface wireless registration-table get number=$ID radio-name]
:set $CPULoad [/system resource get cpu-load]
:set $total "$name: TX = $TX, RX = $RX, CPU-Load = $CPULoad, ID = $ID"
}
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Problems reading values out of the registration-table

Tue Mar 16, 2021 1:59 pm

I guess it fails since you try to use ID on an interface. ID change may change when some connects/disconnects etc.
So You need to use the find function.

Here is an example on my script to get the signal strengt from all user connected.
:do {
	:if ([:len [/interface wireless find ]]>0) do={
		:foreach logline in=[/interface wireless registration-table find] do={
			:local output "$[/interface wireless registration-table print  as-value from=$logline]"
			:set ( "$output"->"script" ) "wifi"
			:log info message="$output"
		}
	}
} on-error={}
Script is part of my Splunk monitoring solution found here:
viewtopic.php?t=137338
 
Strauch
just joined
Topic Author
Posts: 2
Joined: Thu Mar 11, 2021 4:10 pm

Re: Problems reading values out of the registration-table

Tue Apr 13, 2021 9:28 am

Hi Jotne,

thank you for your answer :). Sorry i had a little bit other things to do in the last time, so that I will try it in the next days :).

Who is online

Users browsing this forum: FoxWhite and 19 guests