Extending Net-SNMP

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
Fred
Cacti User
Posts: 81
Joined: Fri Jan 03, 2003 11:43 am

Extending Net-SNMP

Post by Fred »

I know that this isn't technically the right forum, but I've been unable to find any good resources on how to extend SNMP. I'd like to gather some other information from my remote linux hosts, and while I used an ssh host to do it in the past, I feel like doing it with snmp is more secure and the "right" way to go about it.

I'm completely comfortable writing scripts in bash and perl, or even C code if I have to, but how do I get SNMP to spit it out on a get?

I found this to add to snmpd.conf in another thread:

Code: Select all

exec    .1.3.6.1.4.1.2021.60 yourscriptname /usr/local/bin/yourscriptname.pl
But with my trial script, snmpd then fails to start. How do I know which OID to assign it to? What should the output of the script look like?

Any good on-line resources on how to do things like this? I'm running Net-SNMP 5.0.8 installed from source with cacti 0.8...
Koyaanisqatsi
Posts: 6
Joined: Tue Jun 10, 2003 1:31 pm
Location: San Luis Obispo, CA
Contact:

Post by Koyaanisqatsi »

Hi Fred,

I usually obtain unknown SNMP OIDs from hosts by running the following commands on a Linux box:

shell> snmpwalk <hostname> <community> .1 > oids.alpha
shell> snmpwalk -On <hostname> <community> .1 > oids.numeric

Then open both output files in separate windows, side by side and scan through them for useful OIDs. The alpha file will have recognizable text names and the numeric file will have the OIDs that you can use in the generic SNMP gathering scripts in Cacti or any other polling tool.

It's slow, but effective.
Mark Chester
IT Manager
Web Associates
805.782.4692
CompuKid101

Post by CompuKid101 »

lets see... i was doing this with netsnmp in cygwin because i couldnt figure out how to do it with window's snmp service


i put this in my snmp config:

exec temps /bin/perl /root/temps/test

and it added it to its own automatic OID

make a perl script that simply prints a unique value then snmpwalk localhost and grep for it

that should give you the area that net-snmp adds the execs output to the OIDs


:D
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests