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.2cto.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.2cto.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.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.1 10、修改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 1 11、修改Executables/scripts配置,找到如下位置:#exec echotest /bin/echo hello world把注釋去掉 12、修改disk checks配置,找到如下位置:#disk / 10000把注釋去掉 13、修改load average checks配置,找到如下位置:#load 12 14 14 www.2cto.com 把注釋去掉 14、設定社區名為public33e9(此名可以隨便取,用戶端對應即可):# sec.name source communitycom2sec notConfigUser default public33e9 15、# 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 none www.2cto.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