-   Linux - Networking (
-   -   Net-Snmp: Cannot extend agent to run script from configuration file (

skatersam0 06-19-2009 10:22 AM

Net-Snmp: Cannot extend agent to run script from configuration file
Hello Everyone,

I am having a little bit of a problem with net-snmp on Ubuntu Jaunty, and also on Debian Lenny (x64). I have both of the agents configured and up and running. I can query anything in the standard MIBs.
My issue is with trying to extend the agent with just the simple shell script. I will post my current snmpd.conf file here.


rwcommunity public
syslocation "Intern Cube"
syscontact sam@localhost

#if I comment this next line out the conf works great
#exec echotest /bin/echo hello world
exec testing /bin/sh /tmp/test

proc snmpd
proc apache2

disk / 100000

As is if I did an snmp walk it would find the name of shell script (testing) and then it would kill the snmpd process. The script doesn't even start to run before the process dies.

The command I run is:

snmpwalk -v 1 -c public localhost ucdavis
ucdavis is where the scripts are put be default, and the output looks like this:

UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 0
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 0
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 3095572
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 2452832
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 2452832
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000
UCD-SNMP-MIB::memShared.0 = INTEGER: 0
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 42764
UCD-SNMP-MIB::memCached.0 = INTEGER: 254860
UCD-SNMP-MIB::memSwapError.0 = INTEGER: 1
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING: Running out of swap space (0)
UCD-SNMP-MIB::extIndex.1 = INTEGER: 1
UCD-SNMP-MIB::extIndex.2 = INTEGER: 2
UCD-SNMP-MIB::extNames.1 = STRING: testing
Timeout: No Response from localhost

I have been working on this for two entire days now. Any help, or additional thoughts would be greatly appreciated. Thank you!


shrodione 06-24-2009 04:00 PM

SNMP exec
Try formatting your exec command this way. The second argument should be the OID that the command output will be sent to. The third is the name of the command. The fourth is the command itself.

This command works to query netstat information and return it as at the OID shown:


exec netstat /bin/netstat

skatersam0 06-30-2009 11:11 AM

In the man page for snmpd.conf it says that the oid value is optional. I have tried both with, and without and neither one has worked for me. I was however to compile a subagent that uses the agentx protocol to achieve the same result I was looking for. Thank you for your response, unfortunately this solution also doesn't work on my machine. I think that I have some other form of internal configuration error, (e.g. execute permissions not set quite right.). I'm still a little confused as to why it shuts down the snmp daemon if I run it though.

Thanks again,


All times are GMT -5. The time now is 10:39 PM.