SNMP agent software development

Source: Internet
Author: User

The SNMP proxy module consists of six submodules:

The SNMP protocol consists of five types of packets: Get, get-Next, set, get-response, and trap.
L. Get-request operation: extract one or more parameter values from the Agent process
2. Get-next-request operation: extract the next parameter value that follows the current parameter value from the Agent process
3. Set-request operation: set one or more parameter values of the proxy process.
4. Get-response operation: return one or more parameter values. This operation is sent by the proxy process, which is the response operation of the first three operations.
5. Trap Operation: the message sent by the Agent process to notify the management process of some events. The first three packets are sent by the management process, and the last two are sent by the Agent process. On the Agent process side, get or set packets are received by port 161, while on the management process side, trap packets are received by port 162. The following describes five SNMP operations.
(1) the get-request Operation Management site needs to actively read the value of the management object from the agent to obtain the operation data and management information of the device or network, and then plan the network management. SNMP does not support reading one table or one row of data at a time. However, when you need to read multiple data entries and read multiple times, the network burden is increased. Therefore, get-request supports submitting multiple object IDS (OID) at a time ), to get their values at a time and improve network utilization.
(2) the get-next-request operation SNMP does not support reading data from one table or one row at a time. Get-next-request provides a simple method. If you perform the get-next-request operation on an oId, you will receive the instance id of the next readable object, and then get-next-request will receive the next instance id, you can continue to read the entire table. On the one hand, the get-next-request implementation is very simple, but it is inevitably a big headache when reading data in the table. The data in the table is a behavior unit. Each row is composed of several columns. If you read a row of data, you should read each column in this row, however, in the get-next-request table of SNMP, the first column is used to read data from all rows in the first column, and then all rows in the first column are read. In this way, the client needs to do a lot of work. On the other hand, this clearly transfers a lot of unnecessary data and wastes bandwidth. Like get-request, get-next-request can be bound to multiple OID or instance IDs in the PDU to improve efficiency. Similarly, when multiple OID IDs are bound, the corresponding get-response PDU will also return the next available instance id or corresponding error for each oid. Binding multiple OID can be more efficient than executing get-next-request.
(3) In the set-request operation network management, you sometimes need to reconfigure some parameters, configurations, and statuses of the device. A remote management mechanism is required. Set-request is like this. The set operation can be performed on objects with the write-only and read-write permissions in the MIB. Although the set operation provides a convenient way to change the configuration, SNMP does not directly provide operations for remote devices. But this does not mean that SNMP does not have this capability. We can achieve this performance by using the set-request Operation Ground. A device uses MIB to define an operation object. The operation type is write-only or read-write. The operation value is agreed. NMS can set this object, after the device learns that the value of the object has changed in its own way, it can perform operations according to the meaning of the value of the object to achieve remote control. The set operation can also provide several set objects and values at a time to operate on multiple objects in a PDU. The successful response packet of the set operation contains the latest value of the Set object (that is, the set value ).
(4) the get-response operation getresponse responds to get, set, and getnext, Which is passively generated and sent by the agent. When an operation is successfully executed, getresponsepdu contains the OID and value of the object requested for the operation in the operation. As mentioned above, the first three operations support binding multiple objects in a PDU, and the corresponding getresponse response also contains the value of the corresponding variable. For failed operations, the getresponse must mark the corresponding error code in the PDU. Getresponse does not operate on the request-Id field in the request packet. The original number is returned so that the request end can accurately match the response packet with the request packet, it can also be used as a basis for verifying duplicate data packets between the request and the receiver. When the operation is successful, the value of Error-status is noerror, and the value of Error-index is 0. Fill in the Value Field of the variable in variablebindings with the corresponding value. When the operation fails, error-status is the corresponding error code. if the error is caused by an object in the variablebindings group, error-index is the index of the object in variablebindings.
(5) The first three SNMP operations are actively initiated by NMS. There are a large number of devices in the network. It takes some time for NMS to perform round robin, if an important status change occurs to the device, the real-time performance may be lost when the next Round Robin arrives. NMS cannot grasp the changes in device data or status in a timely manner. On the other hand, considering the occupation of the network, it is impossible to go round-robin equipment at a very small interval. Therefore, a mechanism is required to enable devices to send alerts, notify status or configuration changes, and other important events. Trap is an alert PDU actively issued by the agent to notify NMS of important changes. RFC 1157 defines five common types of traps for alarm of these common network states. In addition, a custom type is provided, and a PDU unit is provided to provide the Sub-code of the custom trap for SNMP implementers to define and send their own traps. On the other hand, trap also has some problems. Because SNMP uses UDP and connectionless datagram, trap may not be transmitted to NMS. On the other hand, the agent does not know whether NMS has received the trap. In addition, sending traps are generally caused by important states. In some cases, the system suffers a catastrophic fault, resulting in the failure of traps, such as system crashes and network faults. Therefore, a network management system must combine these operations to complement each other in order to establish a reliable management system. Each operation has one-sidedness.


Development Process:
Use the MG-SOFT to produce the corresponding MIB file, use SMI to set the data type, read and write, and insert the file into the corresponding node;
Use the mib2c command to convert the MIB file to a C file;
The produced C file converts the SIM data type to the Data Type in the C language. At the same time, this function is generated based on different data type functions, such as set/GET request.
After these functions are developed, they are burned into the switch.
Use Mg-soft to send PDU (UDP) under the corresponding node. UDP is used because the UDP protocol is more efficient and it will not increase the network load too much for network management.
After the proxy software in the vswitch receives the PDU, it converts the SMI data type to the C data type and performs corresponding operations based on the information in the PDU;
After the operation is completed, getresponse is generally sent to inform the management software about the status after modification.

Test process:
After the development is complete, the vswitch is like a normal vro. After the computer connects to the vswitch, a setting page is displayed;
You can use Python + selenium to automatically set web elements;
After the configuration is complete, restart the switch and check whether the attribute of the configured element has changed.

 

SNMP agent software development

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.