Community discussions

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

function for ethernet status

Mon Mar 02, 2015 10:39 am

Hello,
I am trying to create a function in dude in order to be alble to check the status of the ethernet in my mikrotik routers but i cant find the correct function. What i need is a function to check if the status of the ethernet has rate 100Mbps. I dont want to do it with SNMP because some times it doesnt. work. Do you have any ideas how to do that?
thanks in advanced!
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: function for ethernet status

Mon Mar 02, 2015 11:07 am

Use my funcion "check_ether1" as example:

check_ether1
if(device_property("Ros"),ros_command(":if ([/interface ethernet get [find where default-name=\"ether1\"] value-name=running]) do={:put 1} else={:put 0}"),0)
 
nomercy14
just joined
Topic Author
Posts: 9
Joined: Mon Jan 26, 2015 4:44 pm

Re: function for ethernet status

Mon Mar 02, 2015 7:45 pm

Thank you for your reply!
Here is what i tried for test but i get error:
ros_command(":if ([/interface ethernet get [find where default-name=\"ether1\"] auto-negotiation]=yes) do={ ([/interface ethernet monitor numbers=[find where default-name=\"ether1\"] once]) do={:if ($rate="100Mbps") do={:put 100} else={:put 10}")}}
I inserted this code as a function in dude but it gives me the code as error. Any ideas?

Who is online

Users browsing this forum: No registered users and 17 guests