net-snmp安装成功后执行mib2c错误

安装后net-snmp后,执行mib2c命令,结果如下:
[root@0 mibs]# pwd
/media/disk2/loongson/netsnmp/net-snmpinstall/share/snmp/mibs
[root@0 mibs]# mib2c
-bash: /usr/local/bin/mib2c: 没有那个文件或目录
可能是perl工具有问题,又到源码目录下执行下面命令,也有错误。提示没有按照net-snmp-config,但确实是安装成功了。请问知道是什么原因吗?谢谢啦!
[root@0 net-snmp-5.7.3]# cd perl
[root@0 perl]# perl Makefile.PL
ERROR from evaluation of /media/disk2/loongson/netsnmp/net-snmpsrc/net-snmp-5.7.3/perl/default_store/Makefile.PL: You need to install net-snmp first (I can't find net-snmp-config) at ./Makefile.PL line 84.

3个回答

你的net-snmp 到底是怎么安装好的,安装在哪个位置,是否为系统路径。
从错误看,没有装到系统目录,所以找不到mib2c这个可执行程序

现在执行mib2c成功,但是会有下面的结果:
root@0 mibs]# MIBS="+RFC1213-MIB" mib2c ifNumber
writing to -
mib2c has multiple configuration files depending on the type of
code you need to write. You must pick one depending on your need.

You requested mib2c to be run on the following part of the MIB tree:
OID: ifNumber
numeric translation: .1.3.6.1.2.1.2.1
number of scalars within: 1
number of tables within: 0
number of notifications within: 0

First, do you want to generate code that is compatible with the
ucd-snmp 4.X line of code, or code for the newer Net-SNMP 5.X code
base (which provides a much greater choice of APIs to pick from):

1) ucd-snmp style code
2) Net-SNMP style code

Select your choice : 1


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


using the mib2c.old-api.conf configuration file to generate your code.
writing to ifNumber.h
writing to ifNumber.c
Warning: something's wrong at /usr/local/bin/mib2c line 821, line 68.
/media/disk2/loongson/netsnmp/net-snmpinstall/share/snmp//mib2c.old-api.conf:68 [ @eval $suffix = substr("$i.commaoid", $namelen + 1)@
]


  • NOTE WELL: The code generated by mib2c is only a template. YOU *
  • must fill in the code before it'll work most of the time. In many *
  • cases, spots that MUST be edited within the files are marked with *
  • /* XXX / or / TODO / comments. * ********************************************************************* running indent on ifNumber.c running indent on ifNumber.h

请问这是什么原因呢?
在default_modules.h文件中已经加了如下内容:
config_require(mibII/ifNumber)
config_add_mib(RFC1213-MIB)
但是在执行mib2c时,在模块初始化注册函数agent_module_inits.h中没有生成对应的内容。该文件目前内容如下:
/* This file is automatically generated by configure. Do not modify by hand. */
if (should_init("vacm_conf")) init_vacm_conf();
if (should_init("usmConf")) init_usmConf();
按理说当执行mib2c命令时应该在该文件中自动生成类似下面内容:
if (should_init("ifNumber")) init_ifNumber();

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐