Community discussions

 
nomercy14
just joined
Topic Author
Posts: 9
Joined: Mon Jan 26, 2015 4:44 pm

get ethernet status rate

Tue Mar 03, 2015 5:49 pm

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?
 
User avatar
PaulsMT
MikroTik Support
MikroTik Support
Posts: 283
Joined: Tue Feb 10, 2015 3:21 pm

Re: get ethernet status rate

Wed Mar 04, 2015 3:24 pm

This value is under name "speed"
try this

{:local a [/interface ethernet get ether1 value-name=speed]; :put "$a"}
 
asptuy
just joined
Posts: 2
Joined: Wed Aug 31, 2011 11:53 pm

Re: get ethernet status rate

Sat Mar 07, 2015 2:32 pm

		$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
 
A9691
just joined
Posts: 13
Joined: Sat May 14, 2016 10:58 am

Re: get ethernet status rate

Thu Dec 28, 2017 1:02 pm

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

Who is online

Users browsing this forum: No registered users and 13 guests