Request help with ros_command function

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.

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

Can a Mikrotik engineer comment on this? Am I wasting my time trying to get this to work?

Can someone comment on this please? Getting the ros_command function to work is critical for us to be able to upgrade from 4b3.

Can someone comment on this please? Getting the ros_command function to work is critical for us to be able to upgrade from 4b3.

I been waiting for someone to help with this too.

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.

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

https://drive.google.com/file/d/1bfVw19ds6sH5wPfV900yMsmPjUPUwQOp/view?usp=sharing

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

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

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]")