Community discussions

MikroTik App
 
-headstrong-
Member
Member
Topic Author
Posts: 377
Joined: Thu Jun 05, 2008 8:04 pm
Location: South Africa

creating custom snmp oid's????

Tue Jul 28, 2009 6:34 pm

Hi guys

Is it possible to create a snmp oid from the output of a script?
 
User avatar
sady
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Jul 11, 2008 11:30 am
Location: Russia

Re: creating custom snmp oid's????

Tue Jul 28, 2009 7:09 pm

and than what? query that oid to device?
than, yes. you just need to parse script otput by array_element function
 
-headstrong-
Member
Member
Topic Author
Posts: 377
Joined: Thu Jun 05, 2008 8:04 pm
Location: South Africa

Re: creating custom snmp oid's????

Tue Jul 28, 2009 7:26 pm

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....
 
User avatar
sady
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Jul 11, 2008 11:30 am
Location: Russia

Re: creating custom snmp oid's????

Wed Jul 29, 2009 1:13 pm

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.

# -----------------------------------------------------------------------------
 
-headstrong-
Member
Member
Topic Author
Posts: 377
Joined: Thu Jun 05, 2008 8:04 pm
Location: South Africa

Re: creating custom snmp oid's????

Wed Jul 29, 2009 3:59 pm

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
 
User avatar
sady
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Jul 11, 2008 11:30 am
Location: Russia

Re: creating custom snmp oid's????

Wed Jul 29, 2009 7:01 pm

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?
 
-headstrong-
Member
Member
Topic Author
Posts: 377
Joined: Thu Jun 05, 2008 8:04 pm
Location: South Africa

Re: creating custom snmp oid's????

Fri Jul 31, 2009 12:42 am

the script is setup on mikrotik routerboard and I am using the dude to run the ros_command...
 
User avatar
sady
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Jul 11, 2008 11:30 am
Location: Russia

Re: creating custom snmp oid's????

Mon Aug 03, 2009 4:11 pm

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....

Who is online

Users browsing this forum: No registered users and 4 guests