SNMPCMD(1)
๐ NAME ๐
snmpcmd โ options and behaviour common to most of the Net-SNMP command-line tools. Welcome to the SNMPCMD(1) page, bestie ๐
this is the shared-options HQ for a whole squad of Net-SNMP commands.
๐ธ SYNOPSIS ๐ธ
snmpcmd [OPTIONS] AGENT [PARAMETERS]
โจ DESCRIPTION โจ
Okay so this manual page describes the common options for the SNMP commands: snmpbulkget, snmpbulkwalk, snmpdelta, snmpget, snmpgetnext, snmpnetstat, snmpset, snmpstatus, snmptable, snmptest, snmptrap, snmpdf, snmpusm, snmpwalk. ๐
The command line applications use the SNMP protocol to communicate with an SNMP capable network entity, an agent. Individual applications typically (but not necessarily) take additional parameters that are given after the agent specification. These parameters are documented in the manual pages for each application. No cap, each tool has its own little lore ๐ซถ
๐ COMMAND-LINE CONFIG OPTIONS ๐
In addition to the options described in this manual page, all of the tokens described in the snmp.conf and other .conf manual pages can be used on the command line of Net-SNMP applications as well by prefixing them with --. EG, specifying --dontLoadHostConfig=true on the command line will turn off loading of the host specific configuration files. It's giving "one config system to rule them all" energy ๐
The snmp.conf file settings and the double-dash arguments over-ride the single-dash arguments. So it's important to note that if single-dash arguments aren't working because you have settings in the snmp.conf file that conflict with them then you'll need to use the longer-form double-dash arguments to successfully trump the snmp.conf file settings. Lowkey crucial, don't skip this one โ ๏ธ
๐ Generic Options ๐
These options control how the Net-SNMP commands behave regardless of what version of SNMP you are using. See further below for options that control specific versions or sub-modules of the SNMP protocol. ๐ฆ
-dโ Dump (in hexadecimal) the raw SNMP packets sent and received. Packet tea, spilled in hex โ-D[TOKEN[,...]]โ Turn on debugging output for the givenTOKEN(s). TryALLfor extremely verbose output. Not me turning on ALL and drowning in debug text ๐ญ-h,--helpโ Display a brief usage message and then exit. The classic "help me bestie" button ๐ซถ-Hโ Display a list of configuration file directives understood by the command and then exit. Directive directory, served fresh ๐-I [brRhu]โ Specifies input parsing options. See INPUT OPTIONS below. ๐-L [eEfFoOsS]โ Specifies output logging options. See LOGGING OPTIONS below. ๐ชต-m MIBLISTโ Specifies a colon separated list of MIB modules (not files) to load for this application. This overrides (or augments) the environment variableMIBS, thesnmp.confdirectivemibs, and the list of MIBs hardcoded into the Net-SNMP library.
If MIBLIST has a leading - or + character, then the MIB modules listed are loaded in addition to the default list, coming before or after this list respectively. Otherwise, the specified MIBs are loaded instead of this default list.
The special keyword ALL is used to load all MIB modules in the MIB directory search list. Every file whose name does not begin with . will be parsed as if it were a MIB file. ALL is iconic but it is also a lot ๐ฟ
-M DIRLISTโ Specifies a colon separated list of directories to search for MIBs. This overrides (or augments) the environment variableMIBDIRS, thesnmp.confdirectivemibdirs, and the default directory hardcoded into the Net-SNMP library (/usr/share/snmp/mibs).
If DIRLIST has a leading - or + character, then the given directories are added to the default list, being searched before or after the directories on this list respectively. Otherwise, the specified directories are searched instead of this default list.
Note that the directories appearing later in the list have precedence over earlier ones. To avoid searching any MIB directories, set the MIBDIRS environment variable to the empty string ("").
Note that MIBs specified using the -m option or the mibs configuration directive will be loaded from one of the directories listed by the -M option (or equivalents). The mibfile directive takes a full path to the specified MIB file, so this does not need to be in the MIB directory search list. Path lore, but make it searchable ๐๏ธ
-v 1 | 2c | 3โ Specifies the protocol version to use:1(RFCs 1155-1157),2c(RFCs 1901-1908), or3(RFCs 2571-2574). The default is typically version 3. Overrides thedefVersiontoken in thesnmp.conffile. Version check, but make it protocol ๐ฅ-O [abeEfnqQsStTuUvxX]โ Specifies output printing options. See OUTPUT OPTIONS below. ๐จ๏ธ-P [cdeRuwW]โ Specifies MIB parsing options. See MIB PARSING OPTIONS below. ๐ง-r retriesโ Specifies the number of retries to be used in the requests. The default is5. Five little "try again" besties ๐-t timeoutโ Specifies the timeout in seconds between retries. The default is1. Floating point numbers can be used to specify fractions of seconds. โฑ๏ธ-V,--versionโ Display version information for the application and then exit. Version reveal, slay ๐-Yname="value"โ Allows one to specify any token ("name") supported in thesnmp.conffile and sets its value to "value". Overrides the corresponding token in thesnmp.conffile. Seesnmp.conf(5)for the full list of tokens. ๐--name="value"โ Same energy, double-dash edition: allows one to specify any token ("name") supported in thesnmp.conffile and sets its value to "value". Overrides the corresponding token in thesnmp.conffile. Seesnmp.conf(5)for the full list of tokens. โจ
๐ SNMPv3 Options ๐
The following options are generic to all forms of SNMPv3, regardless of whether it's the original SNMPv3 with USM or the newer SNMPv3 over (D)TLS support. SNMPv3 is the main character here, fr fr ๐
-l secLevelโ Set thesecurityLevelused for SNMPv3 messages (noAuthNoPriv|authNoPriv|authPriv). Appropriate pass phrase(s) must be provided when using any level higher thannoAuthNoPriv. Overrides thedefSecurityLeveltoken in thesnmp.conffile. ๐-n contextNameโ Set thecontextNameused for SNMPv3 messages. The defaultcontextNameis the empty string"". Overrides thedefContexttoken in thesnmp.conffile. ๐ช
๐ฆ SNMPv3 over TLS Options ๐ฆ
These options pass transport-specific parameters to the TLS layer. If you're using SNMP over TLS or DTLS you'll need to pass a combination of these either through these command line options or through snmp.conf configuration tokens. Secure-channel vibes only ๐
A note about *<certificate-specifier>*s: Net-SNMP looks for X.509 certificates in each of the normal SNMP configuration directory search paths under a "tls" subdirectory. IE, it will look in ~/.snmp/tls and in /usr/local/share/snmp/tls for certificates. The certificate components (eg, the public and private halves) are stored in sub-directories underneath this root set of directories. See the net-snmp-cert tool for help in importing, creating and managing Net-SNMP certificates. *<certificate-specifier>*s can reference either a fingerprint of the certificate to use (the net-snmp-cert tool can help you figure out the certificates) or the filename's prefix can be used. For example, if you had a "snmpd.crt" certificate file then you could simply refer to the certificate via the "snmpd" specifier. Certificate lore, but make it cute ๐
-T localCert=<certificate-specifier>โ Indicates to the transport which key should be used to initiate (D)TLS client connections. This would typically be a certificate found using the certificate fingerprint, the application name (egsnmpd,snmptrapd,perl,python) or genericized name"snmpapp"if using one of the generic applications (snmpget,snmpwalk, etc). This can also be set using thelocalCertspecifier in asnmp.confconfiguration file. ๐-T peerCert=<certificate-specifier>โ If you expect a particular certificate to be presented by the other side then you can use this specifier to indicate the certificate it should present. If it fails to present the expected certificate the client will refuse to open the connection (because doing otherwise could lead to man-in-the-middle attacks). This can also be set using thepeerCertspecifier in asnmp.confconfiguration file. No sketchy impostor certs allowed, periodt ๐-T trust_cert=<certificate-specifier>โ If you have a trusted CA certificate you wish to anchor trust with, you can use this flag to load a given certificate as a trust anchor. A copy of the certificate must exist within the Net-SNMP certificate storage system or this must point to a complete path name. Also see the"trustCert"snmp.confconfiguration token. ๐ฑ-T their_hostname=<name>โ If the server's presented certificate can be validated using a trust anchor then their hostname will be checked to ensure their presented hostname matches one that is expected (you don't want to connect togoodhost.example.comand accept a certificate presented bybadhost.example.comdo you?). This token can specify the exact host name expected to be presented by the remote side, either in asubjectAltNamefield or in theCommonNamefield of the server's X.509 certificate. Hostname match check: because trust issues are not the vibe ๐ซถ
๐ SNMPv3 with USM Options ๐
Okay so these options are specifically for SNMPv3 with the original User-based Security Model (USM). This is the key-nerd section, bestie โ buckle up ๐
-3[MmKk] 0xHEXKEYโ sets the keys used for SNMPv3 transactions. These options let you set the master authentication and encryption keys (-3mand-3Mrespectively) or set the localized authentication and encryption keys (-3kand-3Krespectively). SNMPv3 keys can be either passed in by hand using these flags, or by the use of keys generated from passwords using the-Aand-Xflags discussed below. For further details on SNMPv3 and its usage of keying information, see the Net-SNMP tutorial web site (http://www.Net-SNMP.org/tutorial-5/commands/). Overrides thedefAuthMasterKey(-3m),defPrivMasterKey(-3M),defAuthLocalizedKey(-3k) ordefPrivLocalizedKey(-3K) tokens, respectively, in thesnmp.conffile, seesnmp.conf(5).-a authProtocolโ sets the authentication protocol(MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224)used for authenticated SNMPv3 messages. Overrides thedefAuthTypetoken in thesnmp.conffile.-A authPasswordโ sets the authentication pass phrase used for authenticated SNMPv3 messages. Overrides thedefAuthPassphrasetoken in thesnmp.conffile. It is insecure to specify pass phrases on the command line, seesnmp.conf(5). Like, fr fr, don't do it casually ๐-e engineIDโ sets the authoritative (security) engineID used for SNMPv3 REQUEST messages, given as a hexadecimal string (optionally prefixed by"0x"). It is typically not necessary to specify this engine ID, as it will usually be discovered automatically.-E engineIDโ sets the context engineID used for SNMPv3 REQUEST messages scopedPdu, given as a hexadecimal string. If not specified, this will default to the authoritative engineID.-u secNameโ sets the securityName used for authenticated SNMPv3 messages. Overrides thedefSecurityNametoken in thesnmp.conffile.-x privProtocolโ sets the privacy protocol (DESorAES) used for encrypted SNMPv3 messages. Overrides thedefPrivTypetoken in thesnmp.conffile. This option is only valid if the Net-SNMP software was build to use OpenSSL.-X privPasswordโ sets the privacy pass phrase used for encrypted SNMPv3 messages. Overrides thedefPrivPassphrasetoken in thesnmp.conffile. It is insecure to specify pass phrases on the command line, seesnmp.conf(5). Same warning, bestie โ no cap ๐ซถ-Z boots,timeโ sets theengineBootsandengineTimeused for authenticated SNMPv3 messages. This will initialize the local notion of the agents boots/time with an authenticated value stored in the LCD. It is typically not necessary to specify this option, as these values will usually be discovered automatically.
๐ SNMPv1 and SNMPv2c Options ๐
-c communityโ sets the community string for SNMPv1/v2c transactions. Overrides thedefCommunitytoken in thesnmp.conffile.
๐ AGENT SPECIFICATION ๐
The string AGENT in the SYNOPSIS above specifies the remote SNMP entity with which to communicate. This specification takes the form:
[<transport-specifier>:]<transport-address>
At its simplest, the AGENT specification may consist of a hostname, or an IPv4 address in the standard "dotted quad" notation. In this case, communication will be attempted using UDP/IPv4 to port 161 of the given host. Otherwise, the <transport-address> part of the specification is parsed according to the following list:
udpโhostname[:port]orIPv4-address[:port]tcpโhostname[:port]orIPv4-address[:port]unixโpathnameipxโ[network]:node[/port]aal5pvcorpvcโ[interface.][VPI.]VCIudp6orudpv6orudpipv6โhostname[:port]orIPv6-address:portor'['IPv6-address']'[:port]tcp6ortcpv6ortcpipv6โhostname[:port]orIPv6-address:portor'['IPv6-address']'[:port]
Note that <transport-specifier> strings are case-insensitive so that, for example, tcp and TCP are equivalent. Here are some examples, along with their interpretation:
hostname:161โ perform query using UDP/IPv4 datagrams tohostnameon port161. The:161is redundant here since that is the default SNMP port in any case.udp:hostnameโ identical to the previous specification. Theudp:is redundant here since UDP/IPv4 is the default transport.TCP:hostname:1161โ connect tohostnameon port1161using TCP/IPv4 and perform query over that connection.udp6:hostname:10161โ perform the query using UDP/IPv6 datagrams to port10161onhostname(which will be looked up as an AAAA record).UDP6:[fe80::2d0:b7ff:fe21:c6c0]โ perform the query using UDP/IPv6 datagrams to port161at addressfe80::2d0:b7ff:fe21:c6c0.tcpipv6:[::1]:1611โ connect to port1611on the local host (::1in IPv6 parlance) using TCP/IPv6 and perform query over that connection.tls:hostname:10161/dtls:hostname:10161โ connects using SNMP over DTLS or TLS as documented by the ISMS working group (RFCs not yet published as of this date). This will require (and automatically ensures) that the TSM security model is in use. You'll also need to set up trust paths for the certificates presented by the server (see above for descriptions of this).ssh:hostname:22โ connects using SNMP over SSH as documented by the ISMS working group (RFCs not yet published as of this date). This will require that the TSM security model is in use (--defSecurityModel=tsm).ipx::00D0B7AAE308โ perform query using IPX datagrams to node number00D0B7AAE308on the default network, and using the default IPX port of36879(900Fhexadecimal), as suggested in RFC 1906.ipx:0AE43409:00D0B721C6C0/1161โ perform query using IPX datagrams to port1161on node number00D0B721C6C0on network number0AE43409.unix:/tmp/local-agentโ connect to the Unix domain socket/tmp/local-agent, and perform the query over that connection./tmp/local-agentโ identical to the previous specification, since the Unix domain is the default transport iff the first character of the<transport-address>is a/.alias:mynameโ perform a connection to themynamealias which needs to be defined in thesnmp.conffile using a line likealias myname udp:127.0.0.1:9161. Any type of transport definition can be used as the alias expansion parameter. Aliases are particularly useful for using repeated complex transport strings.AAL5PVC:100โ perform the query using AAL5 PDUs sent on the permanent virtual circuit withVPI=0andVCI=100(decimal) on the first ATM adapter in the machine.PVC:1.10.32โ perform the query using AAL5 PDUs sent on the permanent virtual circuit withVPI=10(decimal) andVCI=32(decimal) on the second ATM adapter in the machine. Note thatPVCis a synonym forAAL5PVC.
Note that not all the transport domains listed above will always be available; for instance, hosts with no IPv6 support will not be able to use udp6 transport addresses, and attempts to do so will result in the error "Unknown host". Likewise, since AAL5 PVC support is only currently available on Linux, it will fail with the same error on other platforms.
โจ MIB PARSING OPTIONS โจ
Okay so the Net-SNMP MIB parser mostly adheres to the Structure of Management Information (SMI). But that spec has changed through time, and in recognition of the (ahem) diversity in compliance expressed in MIB files, there are extra options that give you more flexibility when reading MIB files. Bestie, we love flexibility. ๐
-Pcโ Toggles whether ASN.1 comments should extend to the end of the MIB source line. Strictly speaking, a second appearance of--should terminate the comment, but this breaks some MIB files. The default behaviour (to interpret comments correctly) can also be set with the configuration tokencommentToEOL.-Pdโ Disables the loading of MIB objectDESCRIPTIONs when parsing MIB files. This reduces the amount of memory used by the running application. Lowkey a little memory glow-up. ๐ง-Peโ Toggles whether to show errors encountered when parsing MIB files. These include references to IMPORTed modules and MIB objects that cannot be located in the MIB directory search list. The default behaviour can also be set with the configuration tokenshowMibErrors.-PRโ If the same MIB object (parent name and sub-identifier) appears multiple times in the list of MIB definitions loaded, use the last version to be read in. By default, the first version will be used, and any duplicates discarded. This behaviour can also be set with the configuration tokenmibReplaceWithLatest.
Such ordering is normally only relevant if there are two MIB files with conflicting object definitions for the same OID (or different revisions of the same basic MIB object).
-Puโ Toggles whether to allow the underline character in MIB object names and other symbols. Strictly speaking, this is not valid SMI syntax, but some vendor MIB files define such names. The default behaviour can also be set with the configuration tokenmibAllowUnderline.-Pwโ Show various warning messages in parsing MIB files and building the overall OID tree. This can also be set with the configuration directivemibWarningLevel 1.-PWโ Show some additional warning messages, mostly relating to parsing individual MIB objects. This can also be set with the configuration directivemibWarningLevel 2.
๐ธ OUTPUT OPTIONS ๐ธ
The format of the output from SNMP commands can be controlled using various parameters of the -O flag. The effects of these sub-options can be seen by comparison with the following default output (unless otherwise specified):
$ snmpget -c public -v 1 localhost sysUpTime.0
SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-Oaโ Display string values as ASCII strings (unless there is aDISPLAY-HINTdefined for the corresponding MIB object). By default, the library attempts to determine whether the value is a printable or binary string, and displays it accordingly.
This option does not affect objects that do have a Display Hint.
-Obโ Display table indexes numerically, rather than trying to interpret the instance subidentifiers as string or OID values:
$ snmpgetnext -c public -v 1 localhost vacmSecurityModel
SNMP-VIEW-BASED-ACM-MIB::vacmSecurityModel.0."wes" = xxx
$ snmpgetnext -c public -v 1 -Ob localhost vacmSecurityModel
SNMP-VIEW-BASED-ACM-MIB::vacmSecurityModel.0.3.119.101.115 = xxx
-Oeโ Removes the symbolic labels from enumeration values:
$ snmpget -c public -v 1 localhost ipForwarding.0
IP-MIB::ipForwarding.0 = INTEGER: forwarding(1)
$ snmpget -c public -v 1 -Oe localhost ipForwarding.0
IP-MIB::ipForwarding.0 = INTEGER: 1
-OEโ Modifies index strings to escape the quote characters:
$ snmpgetnext -c public -v 1 localhost vacmSecurityModel
SNMP-VIEW-BASED-ACM-MIB::vacmSecurityModel.0."wes" = xxx
$ snmpgetnext -c public -v 1 -OE localhost vacmSecurityModel
SNMP-VIEW-BASED-ACM-MIB::vacmSecurityModel.0.\"wes\" = xxx
This allows the output to be reused in shell commands. Slay for automation. ๐ซถ
-Ofโ Include the full list of MIB objects when displaying an OID:
.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 =
Timeticks: (14096763) 1 day, 15:09:27.63
-Onโ Displays the OID numerically:
.1.3.6.1.2.1.1.3.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-Op PRECISIONโ Uses the PRECISION string to allow modification of the value output format. This is used with OPAQUE float/double at the moment, but might be usabe for other types in the future. Allowed PRECISION strings are compatible to the flag/field with/precision part of theprintf(3)function:
$ snmpget localhost outputVoltage.1
WIENER-CRATE-MIB::outputVoltage.u0 = Opaque: Float: 0.000000
V
$ snmpget -Op +020.12 localhost outputVoltage.1
WIENER-CRATE-MIB::outputVoltage.u0 = Opaque: Float:
+000000.000000000000 V
-Oqโ Removes the equal sign and type information when displaying varbind values:
SNMPv2-MIB::sysUpTime.0 1:15:09:27.63
-OQโ Removes the type information when displaying varbind values:
SNMPv2-MIB::sysUpTime.0 = 1:15:09:27.63
-Osโ Display the MIB object name (plus any instance or other subidentifiers):
sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-OSโ Display the name of the MIB, as well as the object name:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
This is the default OID output format.
-Otโ Display TimeTicks values as raw numbers:
SNMPv2-MIB::sysUpTime.0 = 14096763
-OTโ If values are printed as Hex strings, display a printable version as well.-Ouโ Display the OID in the traditional UCD-style (inherited from the original CMU code). That means removing a series of "standard" prefixes from the OID, and displaying the remaining list of MIB object names (plus any other subidentifiers):
system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-OUโ Do not print the UNITS suffix at the end of the value.-Ovโ Display the varbind value only, not the OID:
$ snmpget -c public -v 1 -Ov localhost ipForwarding.0
INTEGER: forwarding(1)
-Oxโ Display string values as Hex strings (unless there is aDISPLAY-HINTdefined for the corresponding MIB object). By default, the library attempts to determine whether the value is a printable or binary string, and displays it accordingly.
This option does not affect objects that do have a Display Hint.
-OXโ Display table indexes in a more "program like" output, imitating a traditional array-style index format:
$ snmpgetnext -c public -v 1 localhost ipv6RouteTable
IPv6-MIB::ipv6RouteIfIndex.63.254.1.0.255.0.0.0.0.0.0.0.0.0.0.0.64.1 = INTEGER: 2
$ snmpgetnext -c public -v 1 -OX localhost ipv6RouteTable
IPv6-MIB::ipv6RouteIfIndex[3ffe:100:ff00:0:0:0:0:0][64][1] = INTEGER: 2
Most of these options can also be configured via configuration tokens. See the snmp.conf(5) manual page for details. ๐
๐ LOGGING OPTIONS ๐
The mechanism and destination to use for logging of warning and error messages can be controlled by passing various parameters to the -L flag. Letโs get your logs exactly where you want them, bestie. โจ
-Lnโ Disable all logging.-Leโ Log messages to the standard error stream.-Lf FILEโ Log messages to the specified file.-Loโ Log messages to the standard output stream.-Ls FACILITYโ Log messages via syslog, using the specified facility ('d'forLOG_DAEMON,'u'forLOG_USER, or'0'-'7'forLOG_LOCAL0throughLOG_LOCAL7).
There are also "upper case" versions of each of these options, which allow the corresponding logging mechanism to be restricted to certain priorities of message. Using standard error logging as an example:
-LE priโ will log messages of priority'pri'and above to standard error. See below for possible'pri'values--LE pri1-pri2โ will log messages with priority between'pri1'and'pri2'(inclusive) to standard error.
For -LF and -LS the priority specification comes before the file or facility token. Important detail, no cap. ๐
The priorities recognised are:
0or!forLOG_EMERG,1oraforLOG_ALERT,2orcforLOG_CRIT,3oreforLOG_ERR,4orwforLOG_WARNING,5ornforLOG_NOTICE,6oriforLOG_INFO, and7ordforLOG_DEBUG.
Normal output is (or will be!) logged at a priority level of LOG_NOTICE. ๐
๐ธ INPUT OPTIONS ๐ธ
Okay so the way you read input object names and the values you assign? You can control that with the parameters of the -I flag. The default behavior is described at the end of this section, bestie.
-Ibโ says the given name should be treated as a regular expression, matched case-insensitively against object names in the MIB tree. The "best" match gets used, calculated as the one that matches closest to the beginning of the node name and the highest in the tree. For example, the MIB objectvacmSecurityModelcould be matched by the expressionvacmsecuritymodel(full name, but different case), orvacm.*model(regexp pattern). ๐
Note that . is a special character in regular expression patterns, so the expression cannot specify instance subidentifiers or more than one object name. A "best match" expression will only be applied against single MIB object names. For example, the expression sys*ontact.0 would not match the instance sysContact.0 (although sys*ontact would match sysContact). Similarly, specifying a MIB module name will not succeed (so SNMPv2-MIB::sys.*ontact would not match either). ๐ญ
-Ihโ disables the use ofDISPLAY-HINTinformation when assigning values. This would then require providing the raw value:
snmpset ... HOST-RESOURCES-MIB::hrSystemDate.0
x "07 D2 0C 0A 02 04 06 08"
instead of a formatted version:
snmpset ... HOST-RESOURCES-MIB::hrSystemDate.0
= 2002-12-10,2:4:6.8
-Irโ disables checking table indexes and the value to be assigned against the relevant MIB definitions. This will (hopefully) result in the remote agent reporting an invalid request, rather than checking (and rejecting) this before it is sent to the remote agent. ๐ซถ
Local checks are more efficient (and the diagnostics provided also tend to be more precise), but disabling this behavior is particularly useful when testing the remote agent.
-IRโ enables "random access" lookup of MIB names. Rather than providing a full OID path to the desired MIB object (or qualifying this object with an explicit MIB module name), the MIB tree will be searched for the matching object name. Thus.iso.org.dod.internet.mib-2.system.sysDescr.0(orSNMPv2-MIB::sysDescr.0) can be specified simply assysDescr.0. โจ
โ ๏ธ Warning
Since MIB object names are not globally unique, this approach may return a different MIB object depending on which MIB files have been loaded.
The MIB-MODULE::objectName syntax has the advantage of uniquely identifying a particular MIB object, as well as being slightly more efficient (and automatically loading the necessary MIB file if necessary). ๐
-IsSUFFIX โ adds the specified suffix to each textual OID given on the command line. This can be used to retrieve multiple objects from the same row of a table, by specifying a common index value.-ISPREFIX โ adds the specified prefix to each textual OID given on the command line. This can be used to specify an explicit MIB module name for all objects being retrieved (or for incurably lazy typists). ๐-Iuโ enables the traditional UCD-style approach to interpreting input OIDs. This assumes that OIDs are rooted at themib-2point in the tree (unless they start with an explicit.or include a MIB module name). So thesysDescrinstance above would be referenced assystem.sysDescr.0. ๐
Object names specified with a leading . are always interpreted as "fully qualified" OIDs, listing the sequence of MIB objects from the root of the MIB tree. Such objects and those qualified by an explicit MIB module name are unaffected by the -Ib, -IR and -Iu flags.
Otherwise, if none of the above input options are specified, the default behavior for a "relative" OID is to try and interpret it as an (implicitly) fully qualified OID, then apply "random access" lookup (-IR), followed by "best match" pattern matching (-Ib). Periodt. ๐
๐ฆ ENVIRONMENT VARIABLES ๐ฆ
PREFIXโ the standard prefix for object identifiers (when using UCD-style output). Defaults to.iso.org.dod.internet.mgmt.mib-2.MIBSโ the list of MIBs to load. Defaults toSNMPv2-TC:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:SNMP-VACM-MIB. Overridden by the-moption.MIBDIRSโ the list of directories to search for MIBs. Defaults to/usr/share/snmp/mibs. Overridden by the-Moption.
๐ FILES ๐
/etc/snmp/snmpd.confโ agent configuration file. Seesnmpd.conf(5)./etc/snmp/snmp.conf~/.snmp/snmp.confโ application configuration files. Seesnmp.conf(5).
๐ SEE ALSO ๐
snmpget(1), snmpgetnext(1), snmpset(1), snmpbulkget(1), snmpbulkwalk(1), snmpwalk(1), snmptable(1), snmpnetstat(1), snmpdelta(1), snmptrap(1), snmpinform(1), snmpusm(1), snmpstatus(1), snmptest(1), snmp.conf(5).
Source/version vibes: V5.9.5.2 โจ date: 20 Jul 2010 โจ page: SNMPCMD(1) โ mwah, go read the other pages bestie ๐๐
๐ฆ where this page comes from
- alpine 3.23: net-snmp-doc 5.9.5.2-r0 ยท Net-SNMP
- alpine 3.24: net-snmp-doc 5.9.5.2-r0 ยท Net-SNMP
- arch rolling: net-snmp 5.9.5.2-2 ยท BSD
- Copyright 1988, 1989 by Carnegie Mellon University
- Copyright 2003 Sun Microsystems, Inc. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms