Rotten mud: Use snmpwalk to collect device OID information, snmpwalkoid

Source: Internet
Author: User
Tags snmpwalk

Rotten mud: Use snmpwalk to collect device OID information, snmpwalkoid

This article was sponsored by Xiuyi linfeng and first launched in the dark world.

I plan to start learning about monitoring, but now many monitoring systems are based on SNMP. Many performance indicators of SNMP monitoring are obtained by collecting device OID information through snmpwalk. So today we will introduce how to collect device OID information through snmpwalk.

To use snmpwalk to collect device OID information, perform the following steps:

1. Understand the principles of snmpwalk

2. Install snmpwalk

3. snmpwalk parameter description

4. How to Use snmpwalk

5. Use snmpwalk to collect device OID Information

6. Precautions for device OID information in the production environment

1. Understand the principles of snmpwalk

Snmpwalk is an SNMP tool. It uses the GETNEXT request of SNMP to query all OID tree information of the specified OID (object identification in SNMP protocol) entry and display it to users. You can also use snmpwalk to view other information about devices that support the SNMP protocol (Network Management), such as cisco switches, vro IP addresses, and memory usage. It can also be used to assist in the development of SNMP functions.

Ii. Install snmpwalk

To use snmpwalk, we must first install snmpwalk. Snmpwalk does not have an independent installation package. It is included in the net-snmp package. Therefore, we only need to install the net-snmp package to obtain snmpwalk. The installation of net-snmp is divided into the linux environment and the windows environment. We will introduce it one by one.

2.1 linuxInstall net-snmp

To use the snmpwalk tool in linux, We must install the net-snmp-utils package.

NOTE: If only net-snmp is installed in linux, The snmpwalk tool is not included, as shown below:

Yum-y install net-snmp-utils

Snmpwalk-h

2.2 windowsInstall net-snmp

Install net-snmp in windows. We can download it from the net-snmp official website.

Now we have installed the net-snmp-5.6.1.1-1.x86.exe package. As follows:

The above is one method, and another method is to use it directly. The installation package without installation has been prepared.

The installation package-free installation is easy. You can install the net-snmp package locally, and then copy the bin directory under the installation directory to other servers. As follows:

In this way, you can copy the bin directory to other machines for use. Note: To make it easier to use the snmpwalk tool, we can add the path of this directory to the system environment variables, as shown below:

In this way, we have installed net-snmp. For the snmpwalk installation package-free, you can download the mud snmpwalk5.6.1.1 installation package.

Iii. snmpwalk parameter description

For the usage of snmpwalk, we can view the help information as follows:

Snmpwalk-h

We can see that there are many snmpwalk parameters, but we only use-v and-c parameters. As follows:

-H: displays help.

-V: Specifies the snmp Version, 1, 2c, or 3.

-C: Specifies the SNMP password of the connection device.

-V: displays the current snmpwalk command line version.

-R: specifies the number of retries. The default value is 0.

-T: Specifies the wait time-out time for each request. The value of a single request is in seconds. The default value is 3 seconds.

-L: Specify the security level: noAuthNoPriv | authNoPriv | authPriv.

-A: Authentication Protocol: MD5 | SHA. This parameter is required only when-l is set to authNoPriv or authPriv.

-A: The verification string. This parameter is required only when-l is set to authNoPriv or authPriv.

-X: encryption protocol: DES. It is required only when-l is specified as authPriv.

-X: Encrypted string. It is required only when-l is specified as authPriv.

Iv. snmpwalk usage and Examples

Snmpwalk is easy to use as follows:

Snmpwalk-v 1 or 2c (for SNMP Version)-c SNMP password IP address OID (object identifier)

-V: Specifies the snmp Version, 1 or 2. This parameter must be set.

-C: Specifies the SNMP read password of the connection device. This parameter must be set.

IP: IP address of the device to be walked. This parameter must be set.

OID: indicates the indicator oid of the device. This parameter is not required.

5. Use snmpwalk to obtain device OID Information

Next, we start to use snmpwalk to get some OID information about the device. Note that all the information we get is windows and does not involve linux.

Note: here we also use the MIB asoning MIB Browser to work with our experiments.

5.1Obtain the number of windows Processes

Snmpwalk-v 1-c public 192.168.1.200. 1.3.6.1.2.1.25.1.6

This command indicates that the v1 version is used and the Community is public to walk the. 1.3.6.1.2.1.25.1.6 branch of 192.168.1.200.

5.2Obtain the number of windows users

Snmpwalk-v 1-c public 192.168.1.200. 1.3.6.1.2.1.25.1.5

You can also use the following command:

Snmpwalk-v 1-c public 192.168.1.200 hrSystemNumUsers

Note: hrSystemNumUsers is equivalent to. 1.3.6.1.2.1.25.1.5.

5.1 and 5.2 can be obtained by a command as follows:

Snmpwalk-v 1-c public 192.168.1.200. 1.3.6.1.2.1.25.1

The obtained information includes the system running time, the number of users of the system, the number of processes of the system, and the current time of the system.

5.3Obtain windows total memory

Snmpwalk-v 1-c public 192.168.1.200. 1.3.6.1.2.1.25.2.2

5.4Obtain the IP address of a windows system

Snmpwalk-v 1-c public 192.168.1.200. 1.3.6.1.2.1.4.20.1.1

5.5Obtain windows Information

Snmpwalk-v 1-c public 192.168.1.200 system

5.6Obtain the NIC information of a windows system

Snmpwalk-v 1 192.168.1.200-c public ifDescr

VI,Precautions for device OID information in the production environment

6.1Target and save description

The complete MIB (including the public OID and private OID) of the device is generally required for debugging. Therefore, you can use it to obtain the MIB of the device. 1 As the target mib Branch (that is, the complete mib file ). In addition, the> Redirection character must be used to output the output to a specified file for transmission convenience.

6.2Parameter options

-Cc is generally used to specify that the OID is not repeated.

If the device is prone to timeout, use the-t and-r parameters to specify the timeout time and number of retries.

6.3 MIBInformation integrity

The End Of the MIB is displayed. Otherwise, it may be a Response timeout error. Adjust the parameters in time according to the error message.

Generally, after you use the snmpwalk-v 1/2c-c community IP. 1> IP. mib command to collect the MIB information of a device, the file IP. mib should contain all the MIB information of the device.

However, according to the actual response, some device vendors may only obtain information starting with 1.3.6.1.2.1 due to the fact that SNMP is not very standard, in this case, use the snmpwalk-v 1/2c-c community IP. 1.3.6.1.4.1> IP address. private. mib collects the private MIB information of the device and the IP address previously collected. mib are sent to R & D.

Summary: the so-called MIB information integrity is used to determine whether the file information output by the snmpwalk command contains OID information starting with iso.3.6.1.2.1 (Public MIB information ), whether it contains information about the OID (Private MIB) Starting with iso.3.6.1.4.1, or even OID information starting with iso.3.6.1.6.1 (this part of information is optional and is not used currently ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.