Page 1 of 1

get ethernet status rate

Posted: Tue Mar 03, 2015 5:49 pm
by nomercy14
Hi all, how can i get from the command line the status rate of an ethernet interface? I can get the full duplex status like this:
interface ethernet get ether full-duplex
but i cant find the rate. Can anyone help?

Re: get ethernet status rate

Posted: Wed Mar 04, 2015 3:24 pm
by PaulsMT
This value is under name "speed"
try this

{:local a [/interface ethernet get ether1 value-name=speed]; :put "$a"}

Re: get ethernet status rate

Posted: Sat Mar 07, 2015 2:32 pm
by asptuy
		$trequest = new RouterOS\Request('/interface ethernet monitor numbers=ether1 once'); 
		$result   = $client->sendSync($trequest)->current();
		echo json_encode(array(
		    'status' => $result('status'),
		    'speed' => $result('rate')
		));
and show all ethernet
		$request = new RouterOS\Request('/interface/ethernet/print');
		$request->setQuery($query);
		$responses = $client->sendSync($request);

		foreach ($responses as $response) {
		    foreach ($response as $name => $value) {
		        echo "| {$name} = {$value} |";
		    }
		    echo "<br>";
		}
:D

Re: get ethernet status rate

Posted: Thu Dec 28, 2017 1:02 pm
by A9691
:put ([/interface ethernet monitor ether1 once as-value]->"rate")
You can also define a function:
:global statusinfo do={:return ([/interface ethernet monitor $1 once as-value]->$2) }
And then get any status info, like rate: [$statusinfo ether1 rate], advertising: [$statusinfo ether1 advertising] ...

PS: speed and rate are not the same, speed is a setting, rate is a state.