centos snmp配置_CentOS 6.5下snmp安装与配置

本文介绍了如何在 CentOS 6.5 上安装和配置 SNMP 服务,包括通过 yum 安装相关包,启动并配置 snmpd 服务,修改 snmpd.conf 文件以设置安全参数,开放 iptables 的 161 端口,并确保服务开机自启。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 检查snmp相关rpm包是否在linux主机上存在.

1.1 可以用rpm -qa |grep snmp查看, 如果snmp相关rpm包不存,一种方法,可以去光盘包中找到相关包去rpm -ivh xxx去安装,另一种方法是配置yum网络源,此处我配置的是163的网络yum源,进行yum install安装,可以把rpm相关的依赖包,交给yum去解决.

1.2 如下为rpm -qa查看snmp相关包是否存在.

[root@extw2 ~]# rpm -qa |grep snmp

net-snmp-utils-5.5-49.el6_5.2.x86_64

net-snmp-perl-5.5-49.el6_5.2.x86_64

net-snmp-5.5-49.el6_5.2.x86_64

net-snmp-devel-5.5-49.el6_5.2.x86_64

net-snmp-libs-5.5-49.el6_5.2.x86_64

[root@extw2 ~]#

[root@extw2 ~]#

[root@extw2 ~]# rpm -qa |grep mrtg

mrtg-libs-2.16.2-7.el6.x86_64

mrtg-2.16.2-7.el6.x86_64

2.snmp包用yum进行安装.

[root@extw2 ~]# yum install -y net-snmp

[root@extw2 ~]# yum install -y net-snmp-devel

[root@extw2 ~]# yum install -y net-snmp-libs

[root@extw2 ~]# yum install -y net-snmp-perl

[root@extw2 ~]# yum install -y net-snmp-utils

[root@extw2 ~]# yum install -y mrtg

3.启动snmp服务

3.1 snmpd启动

[root@extw2 ~]# snmpd

[root@extw2 ~]#

[root@extw2 ~]# service snmpd start

3.2 查看snmp服务

[root@extw2 ~]# service snmpd status

snmpd (pid 2440) is running...

4.修改snmp配置文件(/etc/snmp/snmpd.conf ).

4.1 修改com2sec,community值public修改为jiankongbao,我们是用监控宝进行监控server,db及服务的.

#com2sec notConfigUser  default       public

com2sec notConfigUser  default       jiankongbao

4.2 查找view mib2,将其前面"#"注释去掉.

view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc

4.3 查找 access  notConfigGroup,将read值systemview修改为mib2.

#access  notConfigGroup ""      any       noauth    exact  systemview none none

access  notConfigGroup ""      any       noauth    exact  mib2 none none

5.重启snmp服务.

[root@extw2 ~]# /usr/sbin/snmpd restart

6.iptables防火墙161端口查看.

确定Linux的iptables防火墙调,对流量监控服务器开放了udp 161端口的访问权限

可使用iptables -L -n 查看当前iptables规则.

[root@extw2 ~]# iptables -L -n |grep 161

ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:161

7.开机自动启动snmpd服务.

[root@extw2 ~]# chkconfig --level 2345 snmpd on

[root@extw2 ~]#

[root@extw2 ~]# chkconfig --list |grep snmpd

snmpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@extw2 ~]#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值