Linux RHEL4下安装SNMP并配置
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、到网上()下载或光盘中取上面没有的相关包,并按以下顺序安装: 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.rpm4、启动snmp: /etc/init.d/snmpd start5、让开机自动启动此服务: chkconfig snmpd on6、检测服务是否启用:netstat -tanulp | grep snmp7、验证snmp工具是否可以正常使用:snmptranslate -To | head 没有报错则说明snmp工具可以正常使用--进行配置(9-13不操作可能也不会影响实际应用)--------------8、cd /etc/snmp/ vi snmpd.conf9、找到# 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.1view 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 .1view systemview included .1.3.6.1.2.1.1view systemview included .1.3.6.1.2.1.25.1.110、修改Process checks的配置,把下面三个选项注释去掉,去掉后如下:# Make sure mountd is runningproc 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 111、修改Executables/scripts配置,找到如下位置:#exec echotest /bin/echo hello world把注释去掉12、修改disk checks配置,找到如下位置:#disk / 10000把注释去掉13、修改load average checks配置,找到如下位置:#load 12 14 14 把注释去掉14、设置社区名为public33e9(此名可以随便取,客户端对应即可):# sec.name source communitycom2sec notConfigUser default public33e915、# Finally, grant the group read-only access to the systemview view.# group context sec.model sec.level prefix read write notifaccess notConfigGroup "" any noauth exact systemview none none第三行改为:access notConfigGroup "" any noauth exact all none none16、找到:## incl/excl subtree mask#view all included .1 80去掉第二行的#17、重启服务:/etc/init.d/snmpd restart18、最后检测:snmpwalk -v 2c -c public33e9 localhost if有出现一大片信息,就说明正常了。作者 wang7dao