在ubuntu 12.04 上设置snmp

来源:互联网 发布:剪视频的软件 编辑:程序博客网 时间:2024/06/07 06:10

Install SNMPD  


$ sudo apt-get install snmpd

Create a backup file of snmpd.conf original file that we will edit later

$ sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori

Create the new snmpd.conf file 

$ sudo vim /etc/snmp/snmpd.conf

Add the file with these lines

rocommunity public
syslocation "Your Location"
syscontact admin@domain.com

Then edit the /etc/default/snmpd file

$ sudo vim /etc/default/snmpd

Disable this line below by adding # in front of the line 

#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

And add a new line 

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'

Restart the SNMPD service

$ sudo /etc/init.d/snmpd restart
* Restarting network management services

经试验验证,确实可用。

测试
root@test:~# snmpwalk -v 2c -c public localhost ifDescr

1 0
原创粉丝点击