snmpinfo Command

Purpose

Requests or modifies values of Management Information Base (MIB) variables managed by a Simple Network Management Protocol (SNMP) agent.

Syntax

The get or next Option

snmpinfo [ -m get | next ] [  -v ] [  -c Community ] [  -d Level ] [  -h HostName ] [  -o ObjectsFile ] ... -t Tries ] [ -w Waittime ] Variable. Instance ...

The set Option

snmpinfo -m set-v ] [  -c Community ] [  -d Level ] [  -h HostName ] [  -o ObjectsFile ] ... [  -t Tries ] [ -w Waittime ] Variable . Instance= Value ...

The dump Option

snmpinfo -m dump-v ] [  -c Community ] [  -d Level ] [  -h HostName ] [  -o ObjectsFile ] ... [  -t Tries ] [ -w Waittime ] [  Variable. Instance ] ...

Description

The snmpinfo command requests or modifies values for one or more MIB variables for an SNMP agent. This command may only be issued by a user with root privileges or by a member of the system group.

If the you specify the get option, the snmpinfo command requests information about one or more MIB variables from an SNMP agent.

If you specify the next option, the snmpinfo command requests information from an SNMP agent about the instances following the specified instances. The next option makes it possible to obtain MIB values without knowledge of the instance qualifiers.

If you specify the set option, the snmpinfo command modifies values for one or more MIB variables for an SNMP agent. Only a few MIB variables are designated read-write. The agent that manages the MIB database may take various actions as a side effect of modifying MIB variables. For example, setting the ifAdminStatus MIB variable to 2 will normally shut down a network interface. The action taken is determined by the implementation of the SNMP agent that manages the database.

If you specify the dump option, the snmpinfo command can be used to traverse the entire MIB tree of a given agent. If a group is passed in as the Variable parameter, the snmpinfo command will traverse that specified path of the MIB tree.

The snmpinfo command has a debug facility that will dump debug information for transmitted and received packets. The facility is enabled with the -d flag.

Parameters

Item Description
Value Specifies the value to which the MIB Variable parameter is to be set. A value must be specified for each variable. If a value is not specified, the request packet will be invalid.
Variable Specifies the name in text format or numeric format of a specific MIB variable as defined in the /etc/mib.defs file. If the option to the -m flag is next or dump, the Variable parameter may be specified as a MIB group.
Instance Specifies the instance qualifier for the MIB Variable parameter. The Instance parameter is required if the option to the -m flag is get or set. The Instance parameter is optional if the option to the -m flag is next or dump.
Note:
  1. There should be no blank spaces in the Variable.Instance parameter sequence.
  2. If the Instance parameter is not specified, do not place a . (dot) after the Variable parameter.

For further information, consult RFC 1213, which defines the Management Information Base (MIB) for network management, and RFC 1157, which defines the SNMP protocol for creating requests for MIB information and formatting responses.

Flags

Item Description
-c Community Specifies the community name to be used to query the SNMP agent. If the -c flag is not specified, the default community name is public.
-d Level Specifies the level of I/O debug information. The Level value can be one of:
0
No debug information.
1
Port bindings and the number of bytes transmitted and received.
2
Level 1 plus a hexadecimal dump of incoming and outgoing packets.
3
Level 2 plus an English version of the request and response packets.

If the -d flag is not specified, the default debug level is 0.

-h HostName Specifies the host name of the SNMP agent to be queried. The host name can be an IPv4 address, an IPv6 address, or a host name. If the -h flag is not specified, the default host name is the host name of the machine on which the user is currently logged in.
-m Option Specifies the mode by which to access the MIB variables.

The Option value can be one of:

get
Requests information about the specified MIB variables.
next
Requests the instances following the specified instances.
set
Modifies the specified write access MIB variables.
dump
Dumps the specified section of the MIB tree.
Note:
  1. The option name can be specified by the minimum number of characters required to make it unique.
  2. If the -m flag is not specified, the default mode is get.
-o ObjectsFile Specifies the name of the objects definition file that defines the MIB objects the snmpinfo command can request. If the -o flag is not specified, the default objects definition file name is /etc/mib.defs. See the mosy command for information on creating this file. More than one ObjectsFile can be referenced with the restriction that files containing parent definitions be specified before files containing child definitions.
-t Tries Specifies the number of times the snmpinfo command transmits the SNMP request to the SNMP agent before terminating with the message no SNMP response. If the -t flag is not specified, the default number of tries is 3.
-v Specifies that the output from the snmpinfo command be displayed in verbose mode. If the -v flag is not specified, the information will not be displayed in verbose mode.
-w Specifies the wait time in seconds for the response from the snmpd agent. If the -w flag is not specified, the default wait time is 15 seconds.

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in AIX® Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Limitation

When the snmpdv3 daemon encounters a SMI-v2 data type MIB while processing a SNMPv1 protocol request from snmpinfo manager, it will skip the MIB until it encounters a SMI-v1 data type MIB.

Work around

The clsnmp manager should be configured with SNMPv2 type requests or SNMPv3 type requests to dump all of the MIB variables with the snmpdv3 daemon.

Examples

  1. To get the values for the MIB variable ifDescr.1, for the interface associated with ifIndex.1 and SysDescr, enter:
    snmpinfo -m get -v sysDescr.0 ifDescr.1
    In this example, the -m get flag specifies that the snmpinfo command should retrieve the value of MIB variables ifDescr.1, (the interface description for the interface associated with the ifIndex.1), and sysDescr.0 (the system description of the local host).
  2. To get the value for the MIB variable following the ipAdEntIfIndex MIB variable for the host specified by IP address 192.100.154.1, enter:
    snmpinfo -m next -v 1.3.6.1.2.1.4.20.1.2.192.100.154.1
    In this example, the -m next flag specifies that the snmpinfo command should retrieve the information for the MIB variable ifAdEntIfIndex.192.100.154.1.
  3. To get the value of the first MIB variable in the system group, enter:
    snmpinfo -m next -v -h giants system
    In this example, the -m next flag specifies that the snmpinfo command should retrieve the information for the MIB variable following the system group, which is sysDescr.0; the -v flag indicates verbose mode; the -h flag indicates that the agent to be queried is giants; the group to retrieve information from is system.
  4. To set the value of a MIB variable, enter a command similar to the following:
    snmpinfo -m set -v -h giants -c monitor -t 2 ifAdminStatus.1=2
    In this example, the MIB ifAdminStatus variable is set to 2, or down, for the interface associated with ifIndex.1 on the host known as giants. The -c flag specifies the community for the host. The -t 2 flag specifies that the snmpinfo command will transmit the SNMP request to the SNMP agent 2 times before terminating if no response is received from the SNMP agent.
  5. To dump a group of the MIB tree in verbose mode, enter a command similar to the following:
    snmpinfo -m dump -v interfaces
    In this example the interfaces group is dumped in verbose mode.
  6. To dump the entire MIB tree, enter:
    snmpinfo -m dump
  7. To get the values for the sysName.0 MIB variable, enter:
    snmpinfo -m get -v -h 2000:1:1:1:209:6bff:feae:6d67 sysName.0
    In this example, the -m get flag specifies that the snmpinfo command should retrieve the value of the sysName.0 MIB variables. The -v flag indicates verbose mode. The -h flag indicates that the agent to be queried is an IPv6 address.

Files

Item Description
/etc/mib.defs Defines the Management Information Base (MIB) variables the SNMP agent should recognize and handle.