mib2c用途和用法

1.用途

用于批量注册OID,产生批量的OID注册代码模板。

2.用法

三个文件:

- MIB definition file ---基于该mib文件产生输出文件
- C header file--生成的模板代码头文件
- C implementation file.---生成的模板代码源文件

命令:

mib2c -c mib2c.int_watch.conf nstMIBObjects

***mib2c***

***-c mib2c.int_watch.conf***

(1)指定配置文件

(2)配置文件的位置

  /usr/local/share/snmp/
  /usr/local/share/snmp/mib2c-data
  ./mib2c-conf.d

(3)配置文件的类型

If you're writing code for some scalars, run:

        mib2c -c mib2c.scalar.conf MIBNODE


If you want to magically "tie" integer variables to integerscalars, use:

        mib2c -c mib2c.int_watch.conf MIBNODE


GENERATING CODE FOR TABLES:

The recommended configuration file for tables is the MIBs forDummies, or MFD, configuration file. It hides as much of the SNMPdetails as possible, generating small, easy to understand functions.It is also the most flexible and well documented configuration file.See the agent/mibgroup/if-mib/ifTable/ifTable*.c files for an example:


        mib2c -c mib2c.mfd.conf MIBNODE

If your table data is kept somewhere else (e.g. it's in thekernel and not in the memory of the agent itself) and you need to"iterate" over it to find the right data for the SNMP row beingaccessed. See the agent/mibgroup/mibII/vacm_context.c file for anexample:

        mib2c -c mib2c.iterate.conf MIBNODE

If your table data is kept in the agent (i.e. it's not located inan external source) and is purely data driven (i.e. you do not needto perform any work when a set occurs). See theagent/mibgroup/examples/data_set.c file for an example of such atable:

        mib2c -c mib2c.create-dataset.conf MIBNODE

If your table data is kept in the agent (i.e. it's not located inan external source), and you can keep your data sorted by the tableindex but you do need to perform work when a set occurs:

        mib2c -c mib2c.array-user.conf MIBNODE

GENERATING HEADER FILE DEFINITIONS

To generate just a header with a define for each column number inyour table:

        mib2c -c mib2c.column_defines.conf MIBNODE

To generate just a header with a define for each enum for anycolumn containing enums:

        mib2c -c mib2c.column_enums.conf MIBNODE

        GENERATING CODE FOR THE 4.X LINE OF CODE (THE OLDER API)

        mib2c -c mib2c.old-api.conf MIBNODE

***nstMIBObjects***


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值