Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Arbitrary Extension Commands

&pagelevel(4)&pagelevel

The earliest extension mechanism was the ability to run arbitrary commands or shell scripts. Such commands do not need to be aware of SNMP operations, or conform to any particular behavior - the MIB structures are designed to accommodate any form of command output.

exec [MIBOID] NAME PROG ARGS
sh [MIBOID] NAME PROG ARGS

invoke the named PROG with arguments of ARGS. By default the exit status and first line of output from the command will be reported via the extTable, discarding any additional output.

Entries in this table appear in the order they are read from the configuration file. This means that adding new exec (or sh) directives and restarting the agent, may affect the indexing of other entries.

The PROG argument for exec directives must be a full path to a real binary, as it is executed via the exec() system call. To invoke a shell script, use the sh directive instead.

If MIBOID is specified, then the results will be rooted at this point in the OID tree, returning the exit statement as MIBOID.100.0 and the entire command output in a pseudo-table based at MIBNUM.101, with one 'row' for each line of output.

The layout of this "relocatable" form of exec (or sh) output does not strictly form a valid MIB structure. This mechanism is being deprecated - please see the extend directive (described below) instead.

The agent does not cache the exit status or output of the executed program.

exec and sh extensions can only be configured via the snmpd.conf file. They cannot be setup via SNMP SET requests.

extend [MIBOID] NAME PROG ARGS

works in a similar manner to the exec directive, but with a number of improvements. The MIB tables (nsExtendConfigTable etc) are indexed by the NAME token, so are unaffected by the order in which entries are read from the configuration files. There are two result tables - one (nsExtendOutput1Table) containing the exit status, the first line and full output (as a single string) for each extend entry, and the other (nsExtendOutput2Table) containing the complete output as a series of separate lines.

If MIBOID is specified, then the configuration and result tables will be rooted at this point in the OID tree, but are otherwise structured in exactly the same way. This means that several separate extend directives can specify the same MIBOID root, without conflicting.

The exit status and output is cached for each entry individually, and can be cleared (and the caching behavior configured) using the nsCacheTable.

Can be configured dynamically, using SNMP SET requests to the NET-SNMP-EXTEND-MIB.