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安裝成功