Difference between revisions of "Template:FAQ:Agent 07"
(5.4 release synchronisation) |
(Expand on exec vs. extend) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <CODE>'exec'</CODE> will | + | <CODE>'exec'</CODE> will run the specified command and return the exit status |
− | and | + | and output. Any arguments are passed directly to the command, with no special interpretation. |
<CODE>'sh'</CODE> is similar, but invokes a shell to run the command line given. | <CODE>'sh'</CODE> is similar, but invokes a shell to run the command line given. | ||
Line 12: | Line 12: | ||
None of these mechanisms require the command to have any | None of these mechanisms require the command to have any | ||
− | knowledge of the fact that they are being used in this manner. | + | 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 | But the output is returned in a fixed format, and it is up to | ||
the receiving application to interpret this appropriately. | the receiving application to interpret this appropriately. | ||
+ | |||
+ | Note that the "relocatable" form of the <CODE>'exec'</CODE> directive | ||
+ | (<CODE>exec <I>OID</I> ....</CODE>) produces MIB output that is not strictly valid. | ||
+ | For this reason, support for this has been deprecated in favour of | ||
+ | <CODE>extend <I>OID</I> ... </CODE>, which produces well-formed MIB results | ||
+ | (as well as providing fuller functionality).<BR> | ||
+ | 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 <CODE>ucd-snmp/extensible</CODE> | ||
+ | instead of <CODE>agent/extend</CODE>. | ||
<CODE>'pass'</CODE> is a more general mechanism for implementing | <CODE>'pass'</CODE> 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 should return the information | + | 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. | relevant to the requested OID. | ||
<CODE>'pass-persist'</CODE> is similar, but the command will continue running even after the initial request has been answered. | <CODE>'pass-persist'</CODE> 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 <CODE>'snmpd.conf(5)'</CODE> | All of these mechanisms are described in the <CODE>'snmpd.conf(5)'</CODE> | ||
man page, in the section entitled ''Extending Agent Functionality''. | man page, in the section entitled ''Extending Agent Functionality''. |
Latest revision as of 07:56, 6 August 2009
'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'
directive
(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 ucd-snmp/extensible
instead of agent/extend
.
'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 'snmpd.conf(5)'
man page, in the section entitled Extending Agent Functionality.