Hi guys
Is it possible to create a snmp oid from the output of a script?
Hi guys
Is it possible to create a snmp oid from the output of a script?
and than what? query that oid to device?
than, yes. you just need to parse script otput by array_element function
Well at the moment I use a ros_command (“/system script run CCQ”) in a probe to get specific stats that are not available in snmp…
I want to run the “CCQ” script on the mikrotik every few seconds but convert the output to a snmp oid. Then I can pull the graphs from other programs like MRTG for example…
yes, you can, but that not work of Dude software.
You need to extend ucd-snmp agent, buy adding OID-script equation.
You can use examples from snmpd.conf
###############################################################################
Executables/scripts
You can also have programs run by the agent that return a single
line of output and an exit code. Here are two examples.
exec NAME PROGRAM [ARGS …]
NAME: A generic name.
PROGRAM: The program to run. Include the path!
ARGS: optional arguments to be passed to the program
a simple hello world
#exec echotest /bin/echo hello world
Run a shell script containing:
#!/bin/sh
echo hello world
echo hi there
exit 35
Note: this has been specifically commented out to prevent
accidental security holes due to someone else on your system writing
a /tmp/shtest before you do. Uncomment to use it.
#exec shelltest /bin/sh /tmp/shtest
Then,
% snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8
enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
enterprises.ucdavis.extTable.extEntry.extNames.1 = “echotest”
enterprises.ucdavis.extTable.extEntry.extNames.2 = “shelltest”
enterprises.ucdavis.extTable.extEntry.extCommand.1 = “/bin/echo hello world”
enterprises.ucdavis.extTable.extEntry.extCommand.2 = “/bin/sh /tmp/shtest”
enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
enterprises.ucdavis.extTable.extEntry.extResult.2 = 35
enterprises.ucdavis.extTable.extEntry.extOutput.1 = “hello world.”
enterprises.ucdavis.extTable.extEntry.extOutput.2 = “hello world.”
enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0
enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0
Note that the second line of the /tmp/shtest shell script is cut
off. Also note that the exit status of 35 was returned.
-----------------------------------------------------------------------------
Thanks for your quick replies sady
I am not quite sure what exactly I must do…Do I need to run the scripts on a linux box? Is there a wiki I can follow? I tried googling but didn’t get very far
thanks
may be i misunderstand you question, because i haven’t mikrotik routers.
Where a you running ros_command ? on Mikrotik Router? or in Dude over Mikrotik router device on map?
the script is setup on mikrotik routerboard and I am using the dude to run the ros_command…
then, still, answer is Yes, but Dude software can’t help you in this.
You can run ros_commands (some how) from linux box, and then “transfer” it to snmp oid… This didn’t look pretty…