ssh bash script for wireless stats

Hi,

I am writing an ssh bash script to pull the wireless stats from an AP for connected client details, I am using

/interface wireless registration-table print stats

Is there any way to tell the script to only pull specific stats from this output, like last-ip, tx-ccq, etc ?

The script pulls the stats into bash and then I have been trying to manipulate the data there but the layout of each connected client is different , last-ip is on a different line, different position on line etc so I need to way to get the data in the same format all the time so I can use it.

Has anyone any suggestions on how to do this from a ssh script ?

Thanks,
Ger.

Write a native script that gets the values one by one and prints them out in a predictable order, and run the script from SSH.

I don’t use wireless on any MT routers so the below is sort of pseudo-code:

/interface wireless registration-table
:local last-ip [get last-ip];
:local tx-ccq [get tx-ccq];
(...collect other values...)
:put "last-ip: $last-ip";
:put "tx-ccq: $tx-ccq";

install as a script named ‘whatever’ in “/system script” and run ssh like so:

ssh user@ip '/system script run [/system script find name="whatever"]'