技术源于专注

专注于数据库技术

博客园 首页 新随笔 联系 订阅 管理
  42 随笔 :: 0 文章 :: 7 评论

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
备注:推荐更改一下团体号

posted on 2014-12-10 16:56  NETDATA  阅读(2748)  评论(0编辑  收藏