请通过浏览器功能收藏网页

linux安装SNMP简单服务器监控服务 Linux

发布时间:2018-08-08 11:06:58  作者:本站编辑  来源:本站原创  浏览次数:
我有话说 | 分享 |
www.javainfo.com.cn 上干货 欢迎收藏

若在安装过程中提示权限不够,请切换为ROOT用户下

su 命令


SNMP服务 需要一些依赖包, 一般情况下需要单独先安装 以下三个包 之后,SNMP才可以启动成功。

以下是安装snmp服务需要的rpm包:


libc6-2.23-4-omv2015.0.x86_64.rpm

libsnmp30-debuginfo-5.7.3-2.5.x86_64.rpm

lm_sensors-libs-3.1.1-17.el6.x86_64.rpm

openssl-1.0.1e-16.el6_5.15.x86_64.rpm

perl516-perl-5.16.3-19.sc1.el6.x86_64.rpm

perl516-perl-libs-5.16.3-12.el6.centos.alt.x86_64.rpm


且依赖包有顺序安装要求:

(1)这几个包的安装有一定顺序,在安装的时候,会有提示。比如安装

net-snmp-5.3.2.2-5.el5.i386.rpm时,会提示必须先安装net-snmp-libs-5.3.2.2-5.el5.i386.rpm。


(2)net-snmp-utils-5.3.2.2-5.el5.i386.rpm并不是必须安装的包,但安装它会带来不少帮助,它提供了很多工具,例如可以使用snmptranslate命令查看oid,可以使用snmpget、snmpwalk命令等。


(3)net-snmp-libs-5.3.2.2-5.el5.i386.rpm、net-snmp-5.3.2.2-5.el5.i386.rpm、

net-snmp-utils-5.3.2.2-5.el5.i386.rpm这三个包有一定的版本要求,必须版本一致,否则安装无法成功。我这里都使用的5.3.2.2-5.el5版本,也可以下载其他版本的rpm包,但注意版本要一致,在安装的时候也会提示,哪个版本的包是必须的,你可以根据提示下载需要的包。


依赖包安装完毕后, 以下命令检查是否安装成功 

使用命令:$ rpm -qa|grep snmp

检查是否安装net-snmp-utils-5.3.2.2-5.el5,net-snmp-libs-5.3.2.2-5.el5,net-snmp-5.3.2.2-5.el5三个rpm包


使用命令:$ rpm -qa|grep libsen

检查是否安装libsensors3-2.10.6-55.el5


使用命令:$ rpm -qa|grep lm

检查是否安装lm_sensors-2.10.6-55.el5


报错:   

warning: net-snmp-libs-5.5-54.el6_7.1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY


解决办法:

rpm --import/etc/pki/rpm-gpg/RPM*

-------------

安装依赖包名称:

rpm -ivh --nodeps openssl-1.0.1p-12.1.x86_64.rpm

rpm -ivh --nodeps libsnmp30-debuginfo-5.7.3-2.5.x86_64.rpm 

rpm -ivh --nodeps libc6-2.23-4-omv2015.0.x86_64.rpm 


service snmpd start   启动服务报错:   说明缺少  libsensors.so.4 rpm

Starting snmpd: /usr/sbin/snmpd: error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory

                                                           [FAILED]

安装  rpm -ivh lm_sensors-libs-3.1.1-17.el6.x86_64.rpm 


安装SNMP服务包

 rpm -ivh --nodeps net-snmp-libs-5.5-54.el6_7.1.x86_64.rpm

 rpm -ivh --nodeps net-snmp-5.5-54.el6_7.1.x86_64.rpm

 rpm -ivh --nodeps net-snmp-utils-5.5-54.el6_7.1.x86_64.rpm 


配置SNMP.conf

# By default, the agent responds to the "public" community for read

# only access, if run out of the box without any configuration file in 

# place.  The following examples show you other ways of configuring

# the agent so that you can change the community names, and give

# yourself write access to the mib tree as well.

####

# First, map the community name "public" into a "security name"

#       sec.name  source          community

com2sec notConfigUser  default       public


####

# Second, map the security name into a group name:

#       groupName      securityModel securityName

group   notConfigGroup v1           notConfigUser

group   notConfigGroup v2c           notConfigUser



####

# Third, create a view for us to let the group have rights to:

# Make at least  snmpwalk -v 1 localhost -c public system fast again.

#       name           incl/excl     subtree         mask(optional)

#view    systemview    included   .1.3.6.1.2.1.1

#view    systemview    included   .1.3.6.1.2.1.25.1.1

view    all    included   .1   80

####

# Finally, grant the group read-only access to the systemview view.  只读模式

#       group          context sec.model sec.level prefix read   write  notif

access  notConfigGroup ""      any       noauth    exact  all none none



启动服务:

service snmpd start 


使用命令:$ rpm -qa|grep snmp,检查是否已经安装成功。


你可以将snmp服务设置为开机自启动,这样免去手动启动的麻烦。

使用命令:$ chkconfig snmpd on,将snmpd服务设为开机自启动。


然后使用命令:$ chkconfig --list | grep snmpd,查看是否已经设置成功。


如有疑问 请留言 欢迎提供建议
  • 0

    开心

  • 0

    板砖

  • 0

    感动

  • 0

    有用

  • 0

    疑问

  • 0

    难过

  • 0

    无聊

  • 0

    震惊

评论已有 0