免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 10378 | 回复: 3
打印 上一主题 下一主题

net-snmp mib2c工具生成C程序模板的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-05 09:43 |只看该作者 |倒序浏览
我定义了如下的MIB文件,使用mib2c生成.h .c文件时总是提示如下错误:
============================ERROR INFO START==================
Cannot find module (AlarmTable-MIB): At line 0 in (none)
You didn't give mib2c a valid OID to start with.  IE, I could not find
any information about the mib node "FirstTable-MIB".  This could be caused
because you supplied an incorrectly node, or by the MIB that you're
trying to generate code from isn't loaded.  To make sure your mib is
loaded, run mib2c using this as an example:

   env MIBS="+MY-PERSONAL-MIB" mib2c FirstTable-MIB

You might wish to start by reading the MIB loading tutorial at:

   http://www.net-snmp.org/tutorial-5/commands/mib-options.html

And making sure you can get snmptranslate to display information about
your MIB node.  Once snmptranslate works, then come back and try mib2c
again.
==========================ERROR INFO END=================
请问高人mib2c到底要怎么使用?非常感谢!~

=========================MIB START======================
FirstTest-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-IDENTITY,
    enterprises,
   FROM SNMPv2-SMI;

FirstTestMIB MODULE-IDENTITY
    LAST-UPDATED "200001100000Z" -- Midnight 10 January 2000
    ORGANIZATION "AgentX Working Group"
    CONTACT-INFO "sgudur@hotmail.com"
    DESCRIPTION    "This is the test MIB module"
    REVISION     "200001100000Z" -- Midnight 10 January 2000
    DESCRIPTION "Initial version published as RFC 2742."
    ::= { enterprises 8888 }
   
AlarmInfoTable OBJECT-TYPE
          SYNTAX SEQUENCE OF AlarmInfoEntry
          MAX-ACCESS not-accessible
          STATUS current
          DESCRIPTION            "前台告警池,后台同步告警用"
          ::= { first_test  1 }

AlarmInfoTable OBJECT-TYPE
          SYNTAX AlarmInfoEntry
          MAX-ACCESS not-accessible
          STATUS current
          DESCRIPTION        "告警表结构"
          INDEX { talarmNo }
          ::= { AlarmInfoTable 1 }

AlarmInfoEntry ::=
          SEQUENCE
          {
              talarmNo Unsigned32,
              talarmID Unsigned32,
              talarmCode Unsigned32,
              talarmTime OCTET STRING,
          }
END
===========================MIB END=================

论坛徽章:
0
2 [报告]
发表于 2011-12-01 16:35 |只看该作者
1,把你的mib库拷贝到/usr/local/share/snmp/mibs下
2,配置环境变量:可以在snmp.conf中加入,也可以export MIBS="+test-mib"
3,mib2c tree

论坛徽章:
0
3 [报告]
发表于 2012-02-02 11:32 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
4 [报告]
发表于 2012-04-17 11:29 |只看该作者
回复 2# xuxiaoling100

你好!我也用到mib2c,遇到相同问题,能不能留你qq,方便联系啊~
   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP