Usage of UCD-SNMP in MIB Module

Source: Internet
Author: User

In SNMP, I believe no one knows about the MIB module. Next we will introduce the preparation process of the UCD-SNMP defined by the MIB module. For details, refer to the article. A simple MIB module, next, try to expand several methods of ucd-snmp proxy program snmpd.

First, write a MIB module definition file to be added. compile the syntax of the MIB module definition file, which is described in the SMI section of the SNMP protocol. SMI uses a subset of ASN.1. for more information, see the RFC documentation. since I am not very familiar with how to define the MIB module, I borrowed a MIB sample file from the ucd-snmp project team.

The MIB module definition file is as follows:

1) UCD-SNMP-TUTORIAL-MIB.txt
2) UCD-SNMP-TUTORIAL-MIB DEFINITIONS ::= BEGIN
3) IMPORTS
4) ucdExperimental FROM UCD-SNMP-MIB,
5) MODULE-IDENTITY FROM SNMPv2-SMI
6) MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF;
7) ucdSnmpTutorialMIB MODULE-IDENTITY
8) LAST-UPDATED "0005150000Z"
9) ORGANIZATION "UCDavis"
10) CONTACT-INFO "
11) Author: Wes Hardaker
12) University of California at Davis
13) postal: IT-DCAS
14) UCDavis
15) Davis, CA 95616
16) USA
17) email: wjhardaker@ucdavis.edu
18) phone: +1-530-754-7571
19) "
20) DESCRIPTION "A simple mib for demonstration purposes.
21) "
22) ::= { ucdExperimental 4242 }
23) ustMIBObjects OBJECT IDENTIFIER ::= { ucdSnmpTutorialMIB 1 }
24) ustMIBConformance OBJECT IDENTIFIER ::= { ucdSnmpTutorialMIB 2 }
25) ustScalarSet OBJECT IDENTIFIER ::= { ustMIBObjects 1 }
26) ustSSSimpleString OBJECT-TYPE
27) SYNTAX OCTET STRING
28) MAX-ACCESS read-write
29) STATUS current
30) DESCRIPTION
31) "This is a simple test string. It does nothing more than
32) return its current value, and changes values only when set by
33) an incoming SNMP set request."
34) DEFVAL { Hello World }
35) ::= { ustScalarSet 1 }
36) ustSSSecondsSinceChanged OBJECT-TYPE
37) SYNTAX TimeTicks
38) UNITS "1/100th Seconds"
39) MAX-ACCESS read-only
40) STATUS current
41) DESCRIPTION
42) "This object indicates the number of 1/100th seconds since the
43) ustSSSimpleString object has changed. If it is has never been
44) modified, it will be the time passed since the start of the
45) agent."
46) ::= { ustScalarSet 2 }
47) END

The MIB definition file is in the MIB Tree iso.org. dod. internet. private. enterprise. ucd. ucdExperimental.

A subtree ucdSnmpTutorialMIB is defined and contains a ustScalarSet object. The object contains two variables: ustSSSimpleString and ustSSSenconsSinceChanged. ustSSSimpleString is a string type that can be read and written. ustSSSenconsSinceChanged is a time type, read-only, record the time value of the ustSSSimpleString variable from the last modification to the present. our goal is to add this module to the agent program and get or set the value of the variable through the tool program. first, use the mib2c tool to generate C code.

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.