What's the difference between 'exec', 'sh' and 'pass'?
'exec' will run the specified command and return the exit status
and output. Any arguments are passed directly to the command, with no special interpretation.
'sh' is similar, but invokes a shell to run the command line given.
This means that quoted arguments will be recognised as such, and also
allows redirection, and other similar shell interpretation. The results
are returned in exactly the same way.
'extend' is also similar, but provides a richer and more
flexible MIB framework - both for configuring the exact command to be
run, and for displaying the results.
None of these mechanisms require the command to have any knowledge of SNMP, or the fact that they are being used in this manner. But the output is returned in a fixed format, and it is up to the receiving application to interpret this appropriately.
Note that the "relocatable" form of the
exec OID ....) produces MIB output that is not strictly valid.
For this reason, support for this has been deprecated in favour of
extend OID ... , which produces well-formed MIB results
(as well as providing fuller functionality).
The most recent releases of the agent don't include support for "relocatable exec" by default. This needs to be explicitly included when the agent is first compiled, by including the module
'pass' is a more general mechanism for implementing
arbitrary MIB objects. The specified command will be invoked for any request within
the named MIB subtree, and passed details of the requested OID. It
should return the information
relevant to the requested OID.
'pass-persist' is similar, but the command will continue running even after the initial request has been answered.
These two mechanisms
can be used to implement a particular MIB, following the correct MIB
structure (as opposed to the fixed format of exec/sh/extend).
All of these mechanisms are described in the
man page, in the section entitled Extending Agent Functionality.
- What MIBs are supported?
- What protocols are supported?
- How do I configure the agent?
- How do I remove a MIB from the agent?
- I've installed a new MIB file. Why can't I query it?
- How do I add a MIB to the agent?
- What's the difference between 'exec', 'sh', 'extend' and 'pass'?
- What's the difference between AgentX, SMUX and proxied SNMP?
- What is the purpose of 'dlmod'?
- Which extension mechanism should I use?
- Can I use AgentX when running under Windows?
- How can I run AgentX with a different socket address?
- How can I turn off SMUX support?
- How can I combine two copies of the 'mib2' tree from separate subagents?
- What traps are sent by the agent?
- Where are these traps sent to?
- How can I send a particular trap to selected destinations?
- When I run the agent it runs and then quits without staying around. Why?
- After a while the agent stops responding, and starts eating CPU time. Why?
- How can I stop other people getting at my agent?
- How can I listen on just one particular interface?
- The agent is complaining about 'snmpd.conf'. Where is this?
- Why does the agent complain about 'no access control information'?
- How do I configure access control?
- How do I configure SNMPv3 users?
- The 'createUser' line disappears when I start the agent. Why?
- What's the difference between /var/net-snmp and /usr/local/share/snmp?
- My new agent is ignoring the old snmpd.conf file. Why?
- Where should the snmpd.conf file go?
- Why am I getting "Connection refused"?
- Why can't I see values in the UCDavis 'extensible' or 'disk' trees?
- Why can't I see values in the UCDavis 'memory' or 'vmstat' tree?
- What do the CPU statistics mean - is this the load average?
- How do I get percentage CPU utilization using ssCpuRawIdle?
- What about multi-processor systems?
- The speed/type of my network interfaces is wrong - how can I fix it?
- The interface statistics for my subinterfaces are all zero - why?
- Does the agent support the RMON-MIB?
- What does "klread: bad address" mean?
- What does "nlist err: wombat not found" (or similar) mean?
- What does "Can't open /dev/kmem" mean?
- The system uptime (sysUpTime) returned is wrong!
- Can the agent run multi-threaded?
- Can I use AgentX (or an embedded SNMP agent) in a threaded application?