Problems reading values out of the registration-table

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"
}

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:
http://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/1

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 :).