1. 写mib文件。
2. 复制mib库文件到/usr/local/share/snmp/mibs/:(net snmp 安装目录)
 cp XXX-MIB.txt /usr/local/share/snmp/mibs/
3.加载mib库:
cat /usr/local/share/snmp/snmp.conf
mibs +XXX-MIB
4.检查mib是否正常加载:
snmptranslate -IR -Tp bvcom
+--bvcom(26814)
   |
   +--ipq6800(6800)
      |
      +--bvcomAgentModules(1)
         |
         +-- -RW- Integer32 bvcomAgentModuleObject(1)
         +-- -RW- Integer32 bvcomAgentSubagentObject(2)
         +-- -RW- Integer32 bvcomAgentPluginObject(3)
 
  
5.查看mib2c支持的模板:
ls /usr/local/share/snmp/
mib2c.access_functions.conf    mib2c.create-dataset.conf  mib2c.scalar.conf
mib2c.array-user.conf          mib2c-data                 mib2c.table_data.conf
mib2c.check_values.conf        mib2c.genhtml.conf         mibs
mib2c.check_values_local.conf  mib2c.int_watch.conf       snmp.conf
mib2c.column_defines.conf      mib2c.iterate_access.conf  snmp.conf~
mib2c.column_enums.conf        mib2c.iterate.conf         snmpconf-data
mib2c.column_storage.conf      mib2c.mfd.conf             snmpd.conf
mib2c.conf                     mib2c.notify.conf          snmp_perl.pl
mib2c.container.conf           mib2c.old-api.conf         snmp_perl_trapd.pl
6.通过模板生成.c 和 .h 文件:
mib2c -c mib2c.int_watch.conf bvcomAgentModules
7.通过 snmp_agent_api 编写守护程序 example-demon.c:
8.Makefile:
9.example-demon.conf:
 
 
  
10.运行example-demon 时要用超级管理员运行,不然会出错: