Performing a GET Request (snmpget)

The snmpget CLI application performs GET requests from an InfoHub SNMP module. The snmpget command retrieves data from monitored objects according to the specified View. A typical syntax of the snmpget command for the SNMP Plugin is:

snmpget [<snmpcmd_common_options>] -v2c -c <communitystring> -Oa [-m <MIBModule(s)>] OID [OID]...
snmpcmd_common_options

snmpcmd_common_options are options and agent arguments that are common to most snmp commands. For more information, refer to the man page entry for snmpcmd.

-v

Specifies the SNMP protocol version. If you are using the GT.M SNMP Plugin, always specify -v2c to indicate RFCs (1901-1908) as the SNMP protocol version. For more information, refer to the man page entry for snmpcmd.

-m

Specifies a colon delimited list of MIB modules. If you are using the GT.M SNMP Plugin, you would specify -m INFOHUB-1-MIB as the InfoHub MIB module. The MIB acts as a dictionary that translates mnemonics, which are typically more user-friendly, into the numeric values used in the SMNP protocol. For more information, refer to the man page entry for snmpcmd.

-c

Specifies the community string for SNMP v1/v2c transactions. For more information, refer to the man page entry for snmpcmd.

-Oa

Displays strings in ASCII form. For more information on the -O option, refer to the man page entry for snmpcmd.

OID

OID is the object identifier of a monitored object in an MIB. If your monitored objects are in the InfoHub MIB module, you need to additionally specify one of the four Views and an Object Index. A command like snmptranslate -m INFOHUB-1-MIB -Tp | less displays a list of all objects stored in the InfoHub MIB module.

For more information on the snmpget command options, refer to the man page of the snmpget command.

Examples:

With curr View:

$ snmpget -v2c -c <communitystring> -Oa -m INFOHUB-1-MIB localhost INFOHUB-1-MIB::infohubtestMyBoxSyslogDBFILEXTcurr.0

This example retrieves the current data value of the object infohubtestMyBoxSyslogDBFILEXTcurr.0 from the InfoHub MIB module.

With hist View:

$ snmpget -v2c -c <communitystring> -Oa -m INFOHUB-1-MIB localhost INFOHUB-1-MIB::infohubtestMyBoxSyslogDBFILEXThist.1

This example retrieves the data value of the object prior to the current value. Object Index 1 specifies the value that was set for the infohubtestMyBoxSyslogDBFILEXT object before the current value.

$ snmpget -v2c -c <communitystring> -Oa -m INFOHUB-1-MIB localhost INFOHUB-1-MIB::infohubtestMyBoxSyslogDBFILEXThist.0

This example retrieves the current data value of the object. Note that Object Index 0 for the hist View is the same as curr.0 and specifies the current data value.

With time View:

The time View is only available with snmpgetnext. Because time is specified in seconds since the last UNIX epoch and InfoHub time granularity is much less than one second, snmpget is not able to determine the exact time. For more information see "Performing a GETNEXT request".

With snum View:

$ snmpget -v2c -c <communitystring> -Oa -m INFOHUB-1-MIB localhost INFOHUB-1-MIB::infohubtestMyBoxSyslogGTMFatalsnum.1011912

This example retrieves the data value of a GT.M Fatal error stored on InfoHub with sequence number 1011912. In most cases, you would use the snum View in conjunction with the time View which returns the sequence number of the monitored object's mnemonic OID.

[Note]AIX Notes

On AIX, you need to explicitly specify the port number for the NET-SNMP Agent since another port was assigned during installation (see the agentAddress line in snmpd.conf). A sample snmpget command might look like:

snmpget -v2c -c <communitystring> -Oa -m INFOHUB-1-MIB 127.0.0.1:9716 INFOHUB-1-MIB::infohubtestMyBoxSyslogAllcurr.0

or:

snmpget -v2c -c <communitystring> -Oa -m INFOHUB-1-MIB 127.0.0.1:1610 INFOHUB-1-MIB::infohubtestMyBoxSyslogAllcurr.0

Related Information: