SNMP learning experience

Source: Internet
Author: User
Tags snmp

SNMP architecture and working principle

What is SNMP?
SNMP is a series of protocol groups and specifications. It provides a method to collect Network Management Information from devices in the network. SNMP also provides a way for devices to report problems and errors to network management workstations. The network management is divided into four parts: managed nodes (devices), proxies, network management workstations, and network management protocols.

SNMP

Managed node (device) Network Management Protocol Monitored Device
 Proxy  Special software or firmware used to track the status of Managed Devices
 Network management workstation  A central device that communicates with a proxy on a different managed node and displays the status of these proxies
 Network Management Protocol  Protocols used by network management workstations and proxies for information exchange

Principles and methods for collecting data from managed devices
The following two network management principles must be observed when designing and constructing the network management infrastructure:

  • The traffic caused by management information should not significantly increase the network traffic.
  • The Protocol proxy on the managed device should not significantly increase the additional overhead of system processing, so that the main functions of the device are weakened.
    Therefore, there are two important methods to collect data from managed devices: one is polling-only, and the other is interrupt-based).

Trap-ccted polling is an effective method for network management. The network management workstation polls the agent in the managed device to collect the required data, and displays the collected data on the control platform using numbers or graphs, at the same time, the agent in the managed device can report errors to the network management workstation at any time, such as the pre-defined threshold out-of-bounds, which is called SNMP Trap ).

The concept of proxy and the services provided
An agent is a special software (or firmware) that contains information about a special device and its environment.
Its services:

  • The network management workstation can obtain information about related devices from the agent.
  • The network management workstation can modify, add, or delete table items in the proxy.
  • The network management workstation can set a threshold for a specific self-trap.
  • The proxy can send self-traps to the network management workstation.

MiB Concept
MiB is called the management information library. a mib describes objects or table items contained in the database.

Simple Network Management Protocol

SNMP request/response packets
The Simple Network Management Protocol allows the network management workstation software to communicate with the agent in the managed device. Such communication can include inquiry messages from the management workstation, response messages from the proxy, or self-trapped messages from the proxy to the management workstation.
SNMPv1 is easy to implement. It contains five request/response primitives:

  • Get-Request
  • Set-Request
  • Get-next-Request
  • Get-Response
  • Trap

Message format

IP Header UDP Header Version Community PDU type (0-3) Request ID Error status (0-5) Error Index Name Value Name Value ...

PDU type 4 Enterprise Proxy address Trap type (0-6) Specific Code Timestamp Name Value ...
PDU type Name
0 Get-Request
1 Get-next-Request
2 Get-Response
3 Set-Request
4 Trap

SNMP development tools

Use of development tools
The Development Kit provided by adventnet supports multiple platforms.

  • Agent ++
  • SNMP ++

Microsoft Virtual Studio 6.0 is a C ++ Language Development Kit for Windows. Ms itself provides a group of Apis called winsnmp (detailed documentation is provided in msdn), and Ms provides SNMP extension agent development based on Agent service.

UCD-SNM (net-snmp) P is a well-known C language SNMP development kit on the Linux platform. Open source code is the most commonly used software package for Agent Development.

Use of Auxiliary Tools
Adventnet provides a series of Development Kits for MiB, including:

  • MiB Browser
  • MiB Editor
  • MiB Compiler

Familiar with SNMP Development Process
SNMP Development Process

MiB creation and source code generation
The first step is the MIB design. At the beginning of the MIB design, make sure that the managed objects are included in the management information library to implement the document of ASN.1, the MIB editor provided by adventnet can be used here. You can use the MIB compiler to compile ASN.1 documents into C files and header files.

Agent Development
Agent ++ supports multiple platforms, including Solaris, hp unix, and windows. The usage method is slightly different, but the principle is the same: generate the library file, and use the header file and library file for development.
Make directly in Unix. If there is a problem, adjust some macros/variables in makefile. There is basically no problem in Solaris.
For vc6 compilation in windows, refer to the appendix.

Snmpapp Development
SNMP ++ supports multiple platforms, including Solaris, hp unix, and windows. The usage method is slightly different, but the principle is the same: generate the library file, and use the header file and library file for development.

  • Make directly in Unix. If there is a problem, adjust some macros/variables in makefile. There is basically no problem in Solaris. The new version supports SNMPv3 and uses libdes or other encryption/Decryption libraries.
  • For vc6 compilation in windows, refer to the appendix.

Appendix: vc6 compilation in Windows
Create a project and add all source files and header files.
You need to set the following items in the setting of the project:
1. on the C ++ page, add/I items to the include directory of Agent ++ and SNMP ++.
2. Set it to MTD multi-thread debug mode.
3. Compile and run the program.

The above code is used to compile the agent ++ library.
For the example of Agent ++, you must set the following items in setting of the project:
1. Create a Win32 console program;
2. Add the program code;
3. Add SNMP ++. lib and Agent ++. Lib;
4. On the C ++ page, add/I items to the include directory of Agent ++ and SNMP ++.
5. Set it to MTD multi-thread debug mode.
6. Add ws2_32.lib to the Link Page.
7. Add/nodefaultlib: "libcmtd. lib"
8. Compile and run the program.

 

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.