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 ~]#