Community discussions

MikroTik App
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Request help with ros_command function

Tue Oct 24, 2017 7:58 am

I'm trying to write some probes using the ros_command function on Dude 6.40.3 but cant get it to work. I've tried a few different commands as the parameter for the function but never see anything as a return value. Has anyone used this function successfully? If so could they please post a working example that I can try in my setup.
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Re: Request help with ros_command function

Fri Oct 27, 2017 2:39 am

I found this in the "Probes Thread" topic
Function
Name: NC
Code: ros_command("/routing ospf neighbor print count")
I am just using a test setup on my laptop at this stage so don't have any ospf routes to test with but have added the following line to the appearance of the the CHR device that runs The Dude in my test environment:
[ros_command("/interface ethernet print count")]
If I run the command manually in a Winbox terminal it returns "2" but nothing appears on the device in The Dude map so I'm assuming that the ros_command function is broken somehow in the version that I'm using (6.40.3). Can someone from Mikrotik confirm (or deny) that there is a problem with this function in CHR ver 6.40.3?
ros_command.png
You do not have the required permissions to view the files attached to this post.
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Re: Request help with ros_command function

Sun Nov 05, 2017 11:56 am

Can a Mikrotik engineer comment on this? Am I wasting my time trying to get this to work?
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Re: Request help with ros_command function

Mon Dec 25, 2017 12:42 am

Can someone comment on this please? Getting the ros_command function to work is critical for us to be able to upgrade from 4b3.
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Re: Request help with ros_command function

Mon Dec 25, 2017 1:22 am

Can someone comment on this please? Getting the ros_command function to work is critical for us to be able to upgrade from 4b3.
 
yonnie
just joined
Posts: 24
Joined: Fri Apr 14, 2017 9:27 pm

Re: Request help with ros_command function

Mon Dec 25, 2017 1:25 am

I been waiting for someone to help with this too.
 
peson
Trainer
Trainer
Posts: 202
Joined: Tue Jul 20, 2004 10:33 am
Location: Sweden

Re: Request help with ros_command function

Sun Dec 31, 2017 3:15 pm

Hey,
I was just trying this:
[Device.Name]
# of Routes: [ros_command("/ip route print count")][device_performance()][Device.ServicesDown]
In the Appearance settings in for our Dude-server, it runs as a CHR with ROS 6.39.2.
It shows the amount of routes (3) on the view, so it works for me.
Check in settings that "RouterOS Status" is ok.
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Re: Request help with ros_command function

Sun Apr 01, 2018 9:34 am

OK - I finally got some time to get back onto this.... I have downloaded and set up CHR 6.39.2 but still no luck with this ros_command function. :(
Here is what I've done:
My (very basic) CHR setup
[admin@MikroTik] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic 
 #   ADDRESS            NETWORK         INTERFACE                                
 0 D 192.168.1.125/24   192.168.1.0     ether1                                   
 1   10.10.10.2/24      10.10.10.0      ether2                                   
[admin@MikroTik] > dude print               
         enabled: yes
  data-directory: dude
          status: running
[admin@MikroTik] > interface ethernet print count
2
[admin@MikroTik] > /ip route print count         
3

My label for the CHR device:
[Device.Name]
[device_performance()][Device.ServicesDown]
Interfaces: [ros_command("interface ethernet print count")]
Routes: [ros_command("/ip route print count")]

The result :-? :

https://drive.google.com/file/d/1bfVw19 ... sp=sharing
 
peson
Trainer
Trainer
Posts: 202
Joined: Tue Jul 20, 2004 10:33 am
Location: Sweden

Re: Request help with ros_command function  [SOLVED]

Tue Apr 03, 2018 1:04 am

I think you got something wrong in your settings for the Username and Password in the device settings.
Check Status and RouterOS Status in the General settings tab. Router OS needs to be checked in the settings
If the Username ans Password is correct, check the logged in users (/user active print) on the router, the dude server should be logged in.
 #	WHEN			NAME	ADDRESS		VIA           
 0 R	apr/01/2018 16:28:49	uuuu	xxx.yy.z.aa	dude
 
User avatar
geoffsmith31
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Fri Nov 05, 2010 6:08 am
Location: Toowoomba, Australia

Re: Request help with ros_command function

Thu Apr 12, 2018 2:49 am

Thanks peson. I had to add the username and password to the router object on The Dude map. I also checked the Router OS and Dude Server boxes (not sure if this is required - more experimentation needed). Now the object appearance shows the values that I expect from the ros_command function.

https://photos.app.goo.gl/HZLqFnvAsPvoGWt73
 
sihubert
just joined
Posts: 9
Joined: Wed Feb 13, 2019 1:22 pm

Re: Request help with ros_command function

Mon Feb 18, 2019 12:47 pm

Hi there,
I have exactly the same problem, and setting RouterOS tick box as well as username/password didn't work for me.
I see the "dude" user logged in to the remote ROS device.

As a test, I am just trying to create a Data Source with the following code to display the frequency of a given AP:.
ros_command(":put [/interface wireless get wlan1 frequency];");
This command (run directly in the terminal of the remote device) returns the correct frequency, but in the Dude I always get a return value of "0".

EDIT:
Okay, solved. Actually the ";" was too much, this code in the data source works like a charm :
ros_command(":put [/interface wireless get wlan1 frequency]")

Who is online

Users browsing this forum: No registered users and 27 guests