SNMP MIB Implementation

From OpenCircuits
Revision as of 19:29, 27 September 2010 by Tcwden (talk | contribs) (Created page with 'This wiki describe how to generate a MIB (Management Information Base) for SNMP agent. ==Steps== # Create a Microchip Custom MIB script '''snmp.mib''' (an ASCII text file) for t…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This wiki describe how to generate a MIB (Management Information Base) for SNMP agent.

Steps

  1. Create a Microchip Custom MIB script snmp.mib (an ASCII text file) for the tree structure.
  2. Create a ASN.1 MIB script foo.mib (an ASCII text file) for the tree structure.
  3. Convert foo.mib to binary file using mib2bin
  4. Build snmp's PDU use BER (Base encoding rules) encoder and decoder library to process data that's transfer between NMS and agents.
  5. Build snmp API use uIP-stack to communicate between NMS and Agents (open two ports: The manager speak to agents on one port, the agent responds manager on the other port).
  6. Build binary MIB file reader library.
  7. Build functions service oid tree.
  8. Merge MIB ANS.1 file to NMS.


Create Microchip Custom MIB Script

  • Any tutorial to create this file?


Create ASN.1 MIB Script

  • Build MIB file's written in ANS.1 notation.
  • Any tutorial to create this file?

Abstract Syntax Notation

  • Each MIB variable contains several attributes, such as data type, access type and object identifier.
  • Abstract Syntax Notation version 1 (ASN.1) is a language to define these attributes in SNMP.


Convert MIB to Binary File

                                MIB compiler tools: mib2bin
 mchip.mib (ANS.1 format)   -----------------------------------> foo.bin + foo.h + foo_data.h
  • mib2bin tool is modified from net-snmp to convert ASN.1 format file to three files:
    • Binary file (foo.bin) storing information of OID tree. This file can be placed on an SD media card to be read by the FAT16 file system.
    • C header file (foo_data_h) storing information of OID tree. This file is generated by converting mchip.bin file to the C header file. It's only used when a system don't have system file and place on program memory.
    • C header file (foo.h) storing ID that's reference to function service of OID.

How to use

  • Syntax to use mib2bin tool:
  mib2bin <MIBfile>...
  where:
  MIBfile file is ASN.1 format file. MIBfile = <name>.<type>
  • mib2bin tool will create three files:
    • <name>.bin is the binary file.
    • <name>_data.h is C header file store OID tree.
    • <name>.h is C header file. (The file store Ids).
  • Note:
    • Subfolder mibs containing the basics MIB files (e.g.: RFC1155-SMI, RFC1213-MIB, RFC-1215, SNMPv2-MIB ... for us MIB file), must be present under the directory of execution.
    • If the three files exist, mib2bin tool will overwrite the files.
  • Example:
  mib2bin mchip.txt
  
  mib2bin will generate three files: mchip.bin, mchip_data.h and mchip.h