Have a look at the Probe Thread for examples of the execute function:
http://forum.mikrotik.com/viewtopic.php?f=8&t=12402
This is just one of the many examples:
Function
Name:
check_sap_as
Code:
array_element(execute("sapinfo.exe", concatenate("ashost=", device_property("Name"), " sysnr=", device_property("CustomField1")), "C:\Programme\DUDE\sapinfo"), 0)
Probe
Name:
SAP
Type:
Function
Agent:
default
Available:
if(array_find(oid_column("1.3.6.1.2.1.25.4.2.1.2"), "disp+work.exe")>0, 1, -1)
Error:
if(check_sap_as()=0, "", "SAP logon not possible")
Value:
1
Unit:
running
Rate:
none
If you want to be able to issue a command on a device:
1) Choose Tools from the Dude menu on the left side of the screen.
2) Create a new tool (red plus sign)
3) In the Command field, put execute(blah blah blah......)
(You can insert variables, like device IP through the use of the Insert Variable button)
Now when you right click on a device, and choose Tools from the context menu that pops up, your command should be in the list.
This is really useful and I have quite a few extra tools to run commands on devices
If you want to do something more dangerous, and turn the dude from a network monitor into a network controller...
Just say you want to automate some task like when
disk space < 10%, automatically run
rm -rf /tmp or maybe
del /s /q c:\temp, then build that into a function or probe.
Remember, the dude will run this lots of times if the condition occurs, and sometimes the dude makes mistakes, so you could monumentally stuff up both the dude and all the devices on your network....
Probe
Name:
Disk Space Enforcer
Type:
Function
Agent:
default
Error:
if(drive_c_percent() < 10, if(purge_files_on_remote_system_and_return_free_space_percent() < 10, "low disk space",""),"")
Value:
drive_c_percent()
Unit:
%