您的位置:首页 > 运维架构

cacti被监控机上snmp的安装及报错解决

2012-05-07 17:36 337 查看
如下是我在生产环境部署完cacti后,在被监控端安装snmp的过程记录,因为服务器版本各不相同,32bit和64bit的都有,所以也搜集了各报错信息解决方法如下,也方便以后自己查阅,朋友们如有建议或者哪不合适需修改的地方,欢迎指正.

以下是安装脚本

#!/bin/bash

#wget http://nchc.dl.sourceforge.net/sourceforge/beecrypt/beecrypt-4.1.2.tar.gz
tar -zxf beecrypt-4.1.2.tar.gz

cd beecrypt-4.1.2

./configure --prefix=/usr/

make && make install

ln -s /usr/lib/libelf.so.1 /usr/lib/libelf.so

cd ..

#wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.3.4/net-snmp-5.3.4.tar.gz
tar -zxf net-snmp-5.3.4.tar.gz

cd net-snmp-5.3.4

./configure --prefix=/usr/local/net-snmp --enable-mfd-rewrites --with-default-snmp-version="2" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"

make && make install

cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf

sed -i -e '61s/^/#/' -e '62s#\(com2sec[[:blank:]]..*[[:blank:]]\)\S\S*\([[:blank:]]..*\)#\1192.168.1.50 public#' -e '63s/^$/com2sec mynetwork 192.168.1.0\/24 public/' /usr/local/net-snmp/share/snmp/snmpd.conf

#/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf

#######-----In the main monitoring terminal testing whether SNMP success-----#######

#/usr/local/net-snmp/bin/snmpwalk -v 1 -c public localhost system

net-snmp编译过程中的Error信息及解决方法

安装版本:

net-snmp-5.3.3.tar.gz

安装过程:

tar -zxvf net-snmp-5.3.3.tar.gz

cd net-snmp-5.3.3

./configure

make

make install

出错信息:

在第四步:make

Grep /usr/lib/libbeecrypt.la: No such file or directory

/bin/sed: can't read /usr/lib/libbeecrypt.la: No such file or directory

libtool: link: `/usr/lib/libbeecrypt.la' is not a valid libtool archive

make[1]: *** [libnetsnmpmibs.la] Error 1

make[1]:Leavingdirectory /email/share/ceno_soft/net-snmp-5.3.3/agent'

make: *** [subdirs] Error 1

提示信息应该是缺少libbeecrypt.la ,libbeecrypt.so等共享库

解决方法:

安装beecrypt

下载:beecrypt-4.1.2.tar.gz

安装:

tar -zxvf beecrypt-4.1.2.tar.gz

./configure -prefix=/usr

make && make install

安装beecrypt后继续安装net-snmp

make

执行后继续报错:

/usr/bin/ld: cannot find –lelf

collect2: ld returned 1 exit status

make[1]: *** [snmpd] Error 1 make[1]: Leaving directory `/local/akazam/cacti/bak/net-snmp-5.3.3/agent'

make: *** [subdirs] Error 1

ke[1]: Leaving directory `/local/akazam/cacti/bak/net-snmp-5.3.3/agent

make: *** [subdirs] Error 1

解决方法:

执行命令:

ln -s /usr/lib/libelf.so.1 /usr/lib/libelf.so

问题解决~

注:在64位机器上编译有时会遇到下面错误:

/usr/lib/libpopt.so: could not read symbols: File in wrong format

collect2: ld returned 1 exit status

make:*** [service:snmpd] Error 1

解决方法:

需要在安装文件中做修改:

agent/Makefile:

LIBS = ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) -ldl -lrpm -lrpmio -lpopt -lz -lcrypto -lm $(PERLLDOPTS)

改为

LIBS = ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) -ldl -lrpm -lrpmio /usr/lib64/libpopt.so -lz -lcrypto -lm $(PERLLDOPTS)

apps/Makefile:

TRAPDWITHAGENT = $(USETRAPLIBS) -ldl -lrpm -lrpmio -lpopt -lz -lcrypto -lm

改为

TRAPDWITHAGENT = $(USETRAPLIBS) -ldl -lrpm -lrpmio /usr/lib64/l

ibpopt.so -lz -lcrypto -lm

然后再make && makeinstall
本文出自 “王海鹏” 博客,请务必保留此出处http://wanghaipeng1124.blog.51cto.com/2500801/856172
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: