this article starting at Slime Line the world .
Planning to start learning about monitoring, but now a lot of monitoring systems are based on SNMP. and SNMP monitoring performance indicators are through the Snmpwalk acquisition device OID Information obtained, so today to introduce, how to collect the OID information of the device through Snmpwalk.
To use Snmpwalk to capture the OID information of a device, the following steps are required:
1, understand the principle of snmpwalk
2, Installation Snmpwalk
3. Snmpwalk parameter description
4. How to use Snmpwalk
5. Using Snmpwalk to collect device OID information
6. Equipment OID Information precautions in production environment
First, understand the principle of snmpwalk
Snmpwalk is a tool for SNMP that uses SNMP's getnext request query to specify all OID tree information for the entry of the OID (object identifier in the SNMP protocol) and display it to the user. Snmpwalk can also be used to view additional information about devices that support the SNMP Protocol (network management), such as Cisco switch or router IP addresses, memory usage, and so on, to assist with the development of SNMP capabilities.
Second, installation Snmpwalk
To use Snmpwalk, we will first install Snmpwalk. Snmpwalk does not have a separate installation package, it is included in the NET-SNMP package, so we only need to install the NET-SNMP software package to get snmpwalk. The installation of NET-SNMP is divided into Linux environment and Windows environment, we will introduce each.
2.1 Linux under Install Net-snmp
Using the Snmpwalk tool under Linux, we have to install net-snmp-utils this package.
Note: If Linux installs only Net-snmp, then the Snmpwalk tool is not included, as follows:
Yum-y Install Net-snmp-utils
Snmpwalk-h
650) this.width=650; "title=" clip_image001 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image001" src= "Http://s3.51cto.com/wyfs02/M00/58/3A/wKiom1SsqefB2X1uAALPFkr2YPc147.jpg" Width= "839" height= "375"/>
650) this.width=650; "title=" clip_image002 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image002" src= "Http://s3.51cto.com/wyfs02/M02/58/3A/wKiom1SsqejTVfUNAAQEWJpo3vc559.jpg" Width= "715" height= "448"/>
2.2 Windows Install under Net-snmp
Under Windows install NET-SNMP, we can go to NET-SNMP official website to download.
Now we are installing the Net-snmp-5.6.1.1-1.x86.exe package. As follows:
650) this.width=650; "title=" clip_image003 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image003" src= "Http://s3.51cto.com/wyfs02/M00/58/37/wKioL1SsqqmQiv_nAAXwn3FSN6Y024.jpg" Width= "809" height= "651"/>
650) this.width=650; "title=" clip_image004 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image004" src= "Http://s3.51cto.com/wyfs02/M01/58/3A/wKiom1Ssqenxk9cAAAKop2epqp8146.jpg" Width= "708" height= "510"/>
The above is a method, there is another way is to use directly, has been produced a good free installation package.
The creation of the no-install package is simple, which is to install the NET-SNMP software package locally and then copy the bin directory from the installation directory to the other server. As follows:
650) this.width=650; "title=" clip_image005 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image005" src= "Http://s3.51cto.com/wyfs02/M02/58/37/wKioL1SsqqqzATblAAOcLVvzZVw707.jpg" Width= "974" height= "504"/>
This allows the bin directory to be copied to other machines for use. Note that in the process of using the Snmpwalk tool for more convenient use, we can add the path of the directory to the system environment variables , as follows:
650) this.width=650; "title=" clip_image006 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image006" src= "Http://s3.51cto.com/wyfs02/M00/58/37/wKioL1SsqqrwK6tmAAMizQPZ6qA981.jpg" Width= "818" height= "496"/>
650) this.width=650; "title=" clip_image007 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image007" src= "Http://s3.51cto.com/wyfs02/M00/58/3A/wKiom1Ssqeuidh0FAAMPUi8cnBM601.jpg" Width= "686" height= "503"/>
650) this.width=650; "title=" clip_image008 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image008" src= "Http://s3.51cto.com/wyfs02/M01/58/37/wKioL1SsqqvjFkzpAAJ3gqa0p7c231.jpg" Width= "549" height= "474"/>
650) this.width=650; "title=" clip_image009 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image009" src= "Http://s3.51cto.com/wyfs02/M02/58/37/wKioL1SsqqzDuansAAICdHmhRhA962.jpg" Width= "661" height= "288"/>
so we'll have the NET-SNMP installed. About the Snmpwalk free installation package can be downloaded at this address " slime snmpwalk5.6.1.1 free installation package ".
Three, snmpwalk parameter description
The use of snmpwalk, we can see through the Help information, as follows:
Snmpwalk-h
650) this.width=650; "title=" clip_image010 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image010" src= "Http://s3.51cto.com/wyfs02/M02/58/3A/wKiom1SsqeyxOU-XAAUNEppK0us654.jpg" Width= "571" height= "629"/>
Through, we can see that the parameters of snmpwalk more, but we are more commonly used only the-V and-C parameters . As follows:
–h: Displays Help.
–V: Specifies the version of SNMP, 1 or 2c or 3.
–c: Specifies the connection device SNMP password.
–V: Displays the current Snmpwalk command line version.
–r: Specifies the number of retries, which defaults to 0 times.
–t: Specifies the wait time-out for each request, in seconds, and 3 seconds by default.
–l: Specifies the security level: Noauthnopriv|authnopriv|authpriv.
–a: Authentication protocol: md5| SHA. Required only IF-L is specified as Authnopriv or Authpriv.
–A: Validates the string. Required only IF-L is specified as Authnopriv or Authpriv.
–x: Encryption protocol: DES. Only required IF-L is specified as Authpriv.
–X: Encrypts the string. Only required IF-L is specified as Authpriv.
Four, the use method and example of Snmpwalk
Snmpwalk is simple to use, as follows:
Snmpwalk-v 1 or 2c (for SNMP version)-C SNMP Password IP address OID (object identifier)
–V: Specifies the version of SNMP, 1 or 2, which must have.
–c: Specifies the connection device SNMP read password, which must have.
IP: Specifies the IP address of the device to be walk, which must have.
OID: This parameter is not required to represent the indicator OID to get the device.
V. Using Snmpwalk to obtain device OID information
Let's start with Snmpwalk to get some OID information about the device, and note that the Windows system is now available, not the Linux system.
Note: We also use the MIB ireasoning MIB browser to explore the software to match our experiments.
5.1 gets the number of Windows system processes
Snmpwalk-v 1-c public 192.168.1.200.1.3.6.1.2.1.25.1.6
This command means: Use the V1 version, the community is public, to the 192.168.1.200.1.3.6.1.2.1.25.1.6 Branch for Walk.
650) this.width=650; "title=" clip_image011 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image011" src= "Http://s3.51cto.com/wyfs02/M00/58/3A/wKiom1Ssqe2C_axhAAaLA9bHmRc484.jpg" Width= "height=" "598"/>
5.2 get the number of Windows system users
Snmpwalk-v 1-c public 192.168.1.200.1.3.6.1.2.1.25.1.5
650) this.width=650; "title=" clip_image012 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image012" src= "Http://s3.51cto.com/wyfs02/M01/58/37/wKioL1Ssqq7SGS2SAAWsah1Odm8384.jpg" Width= "height=" "575"/>
We can also obtain the following commands:
Snmpwalk-v 1-c Public 192.168.1.200 hrsystemnumusers
650) this.width=650; "title=" clip_image013 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image013" src= "Http://s3.51cto.com/wyfs02/M01/58/3A/wKiom1Ssqe-jJGeVAAMP8VBQMfE461.jpg" Width= "height=" "322"/>
Note: The hrsystemnumusers is equivalent to. 1.3.6.1.2.1.25.1.5.
5.1 and 5.2 We can actually get through a command, as follows:
Snmpwalk-v 1-c public 192.168.1.200.1.3.6.1.2.1.25.1
650) this.width=650; "title=" clip_image014 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image014" src= "Http://s3.51cto.com/wyfs02/M02/58/37/wKioL1Ssqq_S2NfhAAPul9fUTc4291.jpg" Width= "height="/>
The information obtained includes the running time of the system, the number of users of the system, the number of processes in the system, and the current time of the system.
5.3 get total Windows system memory
Snmpwalk-v 1-c public 192.168.1.200.1.3.6.1.2.1.25.2.2
650) this.width=650; "title=" clip_image015 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image015" src= "Http://s3.51cto.com/wyfs02/M02/58/3A/wKiom1SsqfDyal6QAAUsZ94sbKs514.jpg" Width= "height=" "506"/>
5.4 get the IP address of the Windows system
Snmpwalk-v 1-c public 192.168.1.200.1.3.6.1.2.1.4.20.1.1
650) this.width=650; "title=" clip_image016 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image016" src= "Http://s3.51cto.com/wyfs02/M02/58/3A/wKiom1SsqfHDxRL5AARZEjLcRRI447.jpg" Width= "height=" "507"/>
5.5 Get Windows System Information
Snmpwalk-v 1-c Public 192.168.1.200 System
650) this.width=650; "title=" clip_image017 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image017" src= "Http://s3.51cto.com/wyfs02/M00/58/3A/wKiom1SsqfGzYqo2AASJDlxruhQ881.jpg" Width= "height=" "396"/>
5.6 Get network card information for Windows systems
Snmpwalk-v 1 192.168.1.200-c Public IFDESCR
650) this.width=650; "title=" clip_image018 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image018" src= "Http://s3.51cto.com/wyfs02/M01/58/37/wKioL1SsqrKxKjf8AAod3VVSsJA643.jpg" Width= "height=" "536"/>
Six, Device OID Information considerations in production environments
6.1 get the goal and save description
For the development of equipment MIB information to debug, generally require the device's full MIB (including the public OID and private OID), so when the MIB acquisition of the device, use. 1 as the Target MIB branch (that is, the full MIB file). and generally need to use the output > redirect, output to a specified file for easy transmission.
6.2 parameter Option Description
It is generally necessary to use-CC to specify that an OID is not allowed to repeat.
If the device is more likely to time out, you need to use the-T and-r parameters to specify the time-out and retry times.
6.3 MIB Completeness of information
Full walk to a MIB, at the end of the MIB, will output the word "End of MiB". Otherwise, it may be response timeout and other errors, at this time, according to the error message timely adjust parameters.
650) this.width=650; "title=" clip_image019 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt = "clip_image019" src= "http://s3.51cto.com/wyfs02/M01/58/37/wKioL1SsqrOSF6BYAAHxxs-yJ-0213.jpg" width= "518" Height = "/>"
In general, the Snmpwalk-v 1/2c-c community IP. 1>ip.mib command collects the device MIB information, the file Ip.mib should contain all MIB information for the device.
However, from the actual reaction situation, some equipment manufacturers due to SNMP implementation support is not very standard, so there is only the public MIB information (that is, 1.3.6.1.2.1 beginning of information), then use the command snmpwalk-v 1/2c-c community IP. 1.3.6.1.4.1>ip.private.mib collects the private MIB information of the equipment, and sends the research and development together with the IP.MIB collected previously.
Summary: The integrity of the so-called MIB information, That is, determine whether the file information in the output of the Snmpwalk command contains the OID information (public MIB information) at the beginning of the iso.3.6.1.2.1, and whether it contains the OID information (private MIB information) at the beginning of the iso.3.6.1.4.1, and may even contain the OID information at the beginning of the iso.3.6.1.6.1 ( This part of the information is optional, currently not used).
This article is from the "Slime Row World" blog, please be sure to keep this source http://ilanni.blog.51cto.com/526870/1600100
Slime: Using Snmpwalk to capture device OID information