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

转载于:https://www.cnblogs.com/shawnloong/p/4155863.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值