分类: LINUX
2006-05-28 22:07:57
.SNMP的設定
snmp從RH9.0後就改為net-snmp,所以跟之前設定略有差別,請修改下列設定檔:
]#vi /etc/snmp/snmpd.conf
com2sec local localhost public
com2sec mynetwork FONT color=#0000ff>192.168.0.0/24 public
group MyRWGroup v1 local
group MyROGroup v1 mynetwork
group MyRWGroup v2c local
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view all included .1 80
access MyROGroup "" any noauth prefix all none none
access MyRWGroup "" any noauth prefix all all all
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
local此行一定要有.
修改完請重新啟動,/etc/rc.d/init.d/snmpd restart
測試snmp,
]#snmpwalk localhost -c public -v 1
測試mailscanner-mrtg使用的v2c uptime
]#snmpwalk -v 2c -c public localhost uptime
使用时,只要把原配置文件备份后,新建一个/etc/snmp/snmpd.conf,把那段红色代码放入文件中就可以了
如果使用rpm包安装,启动方法可以是service snmpd start
或重起service snmpd restart