MENU

How do I get the OID with the snmp command?

環境

  • RHE8.2
  • net-snmp.x86_64  1:5.8-30.el8

問題

  • I do not know the options for the snmp command (snmpget).

解決

STEP
Determine the options for the snmpge command.
STEP
snmp version

Sets the version of snmp communication.

SNMPv1 or SNMPv2c is commonly used.

SNMPv3 allows secure communication.

SNMP versionsoptionsDescription
SNMPv1-v 1SNMP messages for Get Request, GetNext Request, Set Request, Get Response, and TRAP are available. Authentication is by community name in plain text only.
SNMPv2c-v 2cIn addition to v1 messages, additional GetBulk Request and Inform Request SNMP messages are available.
Authentication is by community name in plain text only. (Same as SNMPv1)
SNMPv3-v 3SNMP messages can be the same as v2c messages.
Authentication can be done by plaintext or encrypted authentication using the USM (User-based Security-Model).
STEP
Community Name

SNMPv1 or SNMPv2c must be set if selected.

If the source and destination community names do not match, the OID cannot be obtained.

The initial community name for net-snmp is public.

STEP
Destination

Set the IP address or host name.

When communicating with your own server, set localhost.

STEP
OID

Specify the OID to be obtained. A sample is shown below.

MIBOIDDescription
SNMPv2-MIB::sysDescr.01.3.6.1.2.1.1.1.0Name or version of hardware, OS, or network OS.
STEP
Execute snmpget command
STEP
Command execution
# snmpget -v 2c -c public localhost SNMPv2-MIB::sysDescr.0
# snmpget -v 2c -c public localhost 1.3.6.1.2.1.1.1.0
STEP
Response check
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Fri Oct 18 06:18:15 EDT 2024 x86_64
Let's share this post !

Author of this article

Comments

To comment

TOC