Issuing queries

SUSE Linux Enterprise Server 15 SP5 LPAR mode z/VM guest

You can issue queries against your SNMP setup.

About this task

Examples of what SNMP queries might look like are given here. For more comprehensive information about the primary agent commands see the snmpcmd man page.

The commands can use either numeric or textual OIDs. While the numeric OIDs might provide better performance, the textual OIDs are more meaningful and give a hint on which information is requested.

Examples

The query examples assume an interface, eth0, for which the CHPID is 6B. You can use the lsqeth command to find the mapping of interface names to CHPIDs.
  • To list the ifIndex and interface description relation (on one line):
    # snmpget -v 2c -c osacom localhost interfaces.ifTable.ifEntry.ifDescr.6
    interfaces.ifTable.ifEntry.ifDescr.6 = eth0
    Using this GET request you can see that eth0 has the ifIndex 6 assigned.
  • To find the CHPID numbers for your OSA devices:
    # snmpwalk -OS -v 2c -c osacom localhost .1.3.6.1.4.1.2.6.188.1.1.1.1
    IBM-OSA-MIB::ibmOSAExpChannelNumber.6 = Hex-STRING: 00 6B
    IBM-OSA-MIB::ibmOSAExpChannelNumber.7 = Hex-STRING: 00 7A
    IBM-OSA-MIB::ibmOSAExpChannelNumber.8 = Hex-STRING: 00 7D
    The first line of the command output, with index number 6, corresponds to CHPID 0x6B of the eth0 example. The example assumes that the community osacom is authorized as described in Configuring access control (snmp.conf).
    If you provided defaults for the SNMP version and the community (see step 12 in Configuring access control (snmp.conf)), you can omit the -v and -c options:
    # snmpwalk -OS localhost .1.3.6.1.4.1.2.6.188.1.1.1.1
    IBM-OSA-MIB::ibmOSAExpChannelNumber.6 = Hex-STRING: 00 6B
    IBM-OSA-MIB::ibmOSAExpChannelNumber.7 = Hex-STRING: 00 7A
    IBM-OSA-MIB::ibmOSAExpChannelNumber.8 = Hex-STRING: 00 7D
    You can obtain the same output by substituting the numeric OID .1.3.6.1.4.1.2.6.188.1.1.1.1 with its textual equivalent (to be specified on a single line):
    .iso.org.dod.internet.private.enterprises.ibm.
    ibmProd.ibmOSAMib.ibmOSAMibObjects.ibmOSAExpChannelTable.
    ibmOSAExpChannelEntry.ibmOSAExpChannelNumber
    You can shorten this unwieldy OID to the last element, ibmOsaExpChannelNumber:
    # snmpwalk -OS localhost ibmOsaExpChannelNumber
    IBM-OSA-MIB::ibmOSAExpChannelNumber.6 = Hex-STRING: 00 6B
    IBM-OSA-MIB::ibmOSAExpChannelNumber.7 = Hex-STRING: 00 7A
    IBM-OSA-MIB::ibmOSAExpChannelNumber.8 = Hex-STRING: 00 7D
  • To find the port type for the interface with index number 6:
    # snmpwalk -OS localhost .1.3.6.1.4.1.2.6.188.1.4.1.2.6
    IBM-OSA-MIB::ibmOsaExpEthPortType.6 = INTEGER: fastEthernet(81)
    fastEthernet(81) corresponds to card type OSD_100.

    Using the short form of the textual OID:

    # snmpwalk -OS localhost ibmOsaExpEthPortType.6
    IBM-OSA-MIB::ibmOsaExpEthPortType.6 = INTEGER: fastEthernet(81)
    Specifying the index, 6 in the example, limits the output to the interface of interest.