NET-SNMP的官方网站是:http://www.net-snmp.org
先阅读一下官网的一点说明(详细见官网)
Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg.routers), computer equipment and even devices like UPSs. Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6
...
安装
在http://www.net-snmp.org/download.html选择最新版本进行下载
wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6/net-snmp-5.6.tar.gz
tar -xvf net-snmp-5.6.tar.gz
cd net-snmp-5.6
./configure --prefix=/usr/local/net-snmp --with-default-snmp-version="2" --with-logfile=/usr/local/net-snmp/log/snmplog.log --with-persistent-directory=/var/net-snmp
注
--prefix 安装的路径
--with-default-snmp-version 默认的版本
--with-logfile 日志文件的路径
--with-persistent-directory 固定数据存储目录
make && make install
cp EXAPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
vi snmpd.conf
60 # sec.name source community
61 com2sec local localhost COMMUNITY
62 com2sec mynetwork NETWORK/24 COMMUNITY
修改为
60 # sec.name source community
61 com2sec local localhost public
62 com2sec mynetwork NETWORK/24 public
在/etc/rc.local追加
/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf
在/etc/profile文件的export命令前追加
PATH=/usr/local/net-snmp/bin:/usr/local/net-snmp/sbin:$PATH
检查
使用 ps -aux | grep snmpd查看snmpd的进程是否启动
使用如下命令从本机检查snmp是否得到系统数据
snmpwalk -v 2c -c public localhost
如果返回的不是Time out,而是系统信息就说明net-snmp安装成功