Monitor Syntax - How to stop outputting extraneous info

I would like to stop the “monitor once” command from displaying the stats to the screen. Is there any way to do this?

I do see that, in the documentation I see that “do” explicitly states “Execute given script after each time it prints stats on the screen”. It is interesting to note that it actually appears output the result of the :put command and then prints the stats. Opposite of the documented behavior.

Example:

/interface ethernet monitor ether1 once do={:put "TestStatusOutput:\t$status"}

This gives me the following output:

TestStatusOutput: link-ok

name: ether1
status: link-ok
auto-negotiation: done
rate: 2.5Gbps
full-duplex: yes
tx-flow-control: no
rx-flow-control: no
supported: 10M-baseT-half
10M-baseT-full
100M-baseT-half
100M-baseT-full
1G-baseT-full
2.5G-baseT
advertising: 10M-baseT-half
10M-baseT-full
100M-baseT-half
100M-baseT-full
1G-baseT-full
2.5G-baseT
link-partner-advertising: 10M-baseT-half
10M-baseT-full
100M-baseT-half
100M-baseT-full
2.5G-baseT
5G-baseT
10G-baseT

What do I need to do to stop it outputting everything besides what is defined in the put statement?

Note: I plan to do a loop of this for multiple interfaces. I guess I can collect the results in an array and then output after the data I don’t want is done scrolling off the screen. I would prefer avoid spamming the screen with data I don’t want though.

Thank you.

You can get the result as an array and then choose to display whatever fields you need:

{
    :local data [/interface ethernet monitor ether1 once as-value]; 
    :put ("Status is: " . $data->"status"); 
    :put ("Rate is: " . $data->"rate"); 
    :put ("Array fields: " . [:tostr $data]);
}

There is also proplist=, to control the variables, which allow you skip the do={} if you just want to output a subset of things.

Now @CGGXANNX is likely the better approach, depending on what your doing.