Communicate with a network entity using SNMP GET requests
snmpget [-d] [-p port] [-r retry] [-t timeout] -v 1 host community variable_name [variable_name] snmpget [-d] [-p port] [-r retry] [-t timeout] [-v 2] host noAuth variable_name [variable_name] snmpget [-d] [-p port] [-r retry] [-t timeout] [-v 2] host scrparty dstparty context variable_name [variable_name]
The snmpget utility uses the GET request to query for information about a network entity. You can specify one or more fully qualified object identifiers in the format specified in the file mib.txt.
If you're using SNMP version 2, the following files must be configured:
For a description on how to configure the files please see the file page for each of the configuration files listed above. If you wish to change the location of your configuration files, you must include a snmpd.conf file.
Retrieve the variables sysDescr.0 and sysUpTime.0:
snmpget -v 1 netdev-kbox.cc.cmu.edu public \ system.sysDescr.0 system.sysUpTime.0
snmpget \ netdev-kbox.cc.cmu.edu manager_party \ agent_party agent_context system.sysDescr.0 \ system.sysUpTime.0
The output is similar to:
Name: system.sysDescr.0 OCTET STRING- (ascii): Kinetics FastPath2 Name: system.sysUpTime.0 Timeticks: (2270351) 6:18:23
This ID:
system.syscontact.0
is printed as:
syscontact.0
This ID:
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.161
is printed as:
udpLocalAddress.0.0.0.161
If the network entity has an error processing the request packet, an error packet is returned and snmpget displays a message to help pinpoint how the request was malformed. If you've specified other variables, snmpget resends the request without the variable that caused the problem.
snmpd, snmpgetnext, snmpnetstat, snmpset, snmpstatus, snmptest, snmptranslate, snmptrap, snmptrapd, snmpwalk
/etc/acl.conf, /etc/context.conf, /etc/mib.txt, /etc/party.conf, /etc/snmpd.conf, /etc/view.conf files
ISO 8824 (ASN.1), RFC 1065, RFC 1066, RFC 1067
RFC 1441, RFC 1445, RFC 1446
RFC 1448, RFC 1449
Marshall T. Rose, The Simple Book: An Introduction to Internet Management, Revised 2nd ed. (Prentice-Hall, 1996, ISBN 0-13-451659-1)