Community discussions

MikroTik App
 
celestius
just joined
Topic Author
Posts: 19
Joined: Fri Jun 08, 2007 8:02 pm

SNMP Set Command?

Wed Feb 11, 2009 7:50 am

I may just be overlooking something glaringly obvious but does The Dude have a way to issue set commands to snmp capable devices detected on the network? I have access points that can be configured in this way and it would be extremely useful if I could use The Dude to walk them and set their attributes. Or if this is not a function of the dude (why the heck not???) is there a way to have The Dude pass a particular OID to an external program such as Net-SNMP's snmpset on a command line and set it that way? Thanks in advance for the info.
 
celestius
just joined
Topic Author
Posts: 19
Joined: Fri Jun 08, 2007 8:02 pm

Re: SNMP Set Command?

Tue Feb 24, 2009 12:03 am

Hello? This is lone wolf calling mother hen... come in mother hen. All silliness aside, any info on this would be helpful.
 
adamd292
newbie
Posts: 48
Joined: Tue Oct 07, 2008 8:56 am

Re: SNMP Set Command?

Tue Feb 24, 2009 2:13 am

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




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: %
 
celestius
just joined
Topic Author
Posts: 19
Joined: Fri Jun 08, 2007 8:02 pm

Re: SNMP Set Command?

Fri May 08, 2009 7:05 pm

Thanks for the tip!

Who is online

Users browsing this forum: No registered users and 62 guests