Centos 6.5 SNMP客戶端安裝及配置版本net-snmp-5.7.3


Centos 6.5 SNMP客戶端安裝及配置
SNMP版本:net-snmp-5.7.3.tar.gz
1.下載軟件
cd /usr/local/src
yum -y install gcc
wget http://nchc.dl.sourceforge.net/project/net-snmp/net-snmp/5.7.3/net-snmp-5.7.3.tar.gz

2.解壓編譯安裝
tar -zxvf net-snmp-5.7.3.tar.gz
cd net-snmp-5.7.3
./configure --with-default-snmp-version="2"  --with-sys-contact="zjqs"  --with-sys-location="XSIDC" --with-logfile="/var/log/snmpd.log"  --with-persistent-directory="/opt/net-snmp"
make
make install

4.配置

/usr/local/sbin/snmpd
/usr/local/sbin/snmpd會在/opt/下生成/opt/net-snmpd/snmpd.conf
cd /opt/net-snmpd/
vim snmpd.conf
添加以下內容
com2sec notConfigUser default public
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view all included .1
access notConfigGroup "" any noauth exact all none none
syslocation www.osyunwei.com



注釋說明
public為團體號
syslocation 為位置
啟動snmpd
cd /opt/net-snmpd
/usr/local/sbin/snmpd -c snmpd.conf

編譯防火牆策略
vim /etc/sysconfig/iptables 添加以下內容
-A INPUT -m udp -p udp --dport 161 -j ACCEPT

重啟防火牆

service iptables restart



腳本一鍵安裝
#!/bin/bash
cd /usr/local/src
yum -y install gcc
wget http://nchc.dl.sourceforge.net/project/net-snmp/net-snmp/5.7.3/net-snmp-5.7.3.tar.gz
tar -zxvf net-snmp-5.7.3.tar.gz
cd net-snmp-5.7.3
./configure --with-default-snmp-version="2"  --with-sys-contact="zjqs"  --with-sys-location="XSIDC" --with-logfile="/var/log/snmpd.log"  --with-persistent-directory="/opt/net-snmp"
make
make install
/usr/local/sbin/snmpd
cd /opt/net-snmpd/
echo "com2sec notConfigUser default public">snmpd.conf
echo "group notConfigGroup v1 notConfigUser">>snmpd.conf
echo "group notConfigGroup v2c notConfigUser">>snmpd.conf
echo "view all included .1">>snmpd.conf
echo "access notConfigGroup "" any noauth exact all none none">>snmpd.conf
echo "syslocation www.osyunwei.com">>snmpd.conf
/usr/local/sbin/snmpd -c snmpd.conf
echo "-A INPUT -m udp -p udp --dport 161 -j ACCEPT">>/etc/sysconfig/iptables
備注:推薦更改一下團體號


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM