Linux RHEL4下安装SNMP并配置
--安装-------------
1、先检查有没有安装snmp服务:which snmpd,没有找到就是没有安装
2、再检查一些rpm包有没有安装:
rpm -qa|grep snmp
检查是否安装net-snmp-utils-...,net-snmp-libs-...,net-snmp-...三个rpm包
rpm -qa|grep lm
检查是否安装lm_sensors-...
3、到网上(http://rpm.pbone.net/)下载或光盘中取上面没有的相关包,并按以下顺序安装:
rpm -ivh lm_sensors-2.8.7-2.40.3.i386.rpm
rpm -ivh net-snmp-libs-5.1.2-11.EL4.10.i386.rpm
rpm -ivh net-snmp-5.1.2-11.EL4.10.i386.rpm
rpm -ivh net-snmp-utils-5.1.2-11.EL4.10.i386.rpm
www.ahlinux.com
4、启动snmp:
/etc/init.d/snmpd start
5、让开机自动启动此服务:
chkconfig snmpd on
6、检测服务是否启用:netstat -tanulp | grep snmp
7、验证snmp工具是否可以正常使用:snmptranslate -To | head
没有报错则说明snmp工具可以正常使用
--进行配置(9-13不操作可能也不会影响实际应用)--------------
8、cd /etc/snmp/
vi snmpd.conf
www.ahlinux.com
9、找到
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
插入一行,意思是让客户机可以查看.1节点下的所有设备信息,插入后如下:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
10、修改Process checks的配置,把下面三个选项注释去掉,去掉后如下:
# Make sure mountd is running
proc mountd
# Make sure there are no more than 4 ntalkds running, but 0 is ok too.
proc ntalkd 4
# Make sure at least one sendmail, but less than or equal to 10 are running.
proc sendmail 10 1
11、修改Executables/scripts配置,找到如下位置:
#exec echotest /bin/echo hello world
把注释去掉
12、修改disk checks配置,找到如下位置:
#disk / 10000
把注释去掉
13、修改load average checks配置,找到如下位置:
#load 12 14 14 www.ahlinux.com
把注释去掉
14、设置社区名为public33e9(此名可以随便取,客户端对应即可):
# sec.name source community
com2sec notConfigUser default public33e9
15、# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
第三行改为:
access notConfigGroup "" any noauth exact all none none
www.ahlinux.com
16、找到:
## incl/excl subtree mask
#view all included .1 80
去掉第二行的#
17、重启服务:/etc/init.d/snmpd restart
18、最后检测:snmpwalk -v 2c -c public33e9 localhost if
有出现一大片信息,就说明正常了。
作者 wang7dao
本文来自:Linux教程网