Zabbix的snmp监控

举报
江湖有缘 发表于 2023/02/10 23:45:01 2023/02/10
【摘要】 Zabbix的snmp监控

@TOC

一、SNMP介绍

简单网络管理协议(SNMP) 是专门设计用于在 IP 网络管理网络节点(服务器、工作站、路由器、交换机及HUBS等)的一种标准协议,它是一种应用层协议。

二、服务端安装snmp监控工具

[root@IT-01 ~]# yum -y install net-snmp net-snmp-utils.x86_64 
Last metadata expiration check: 8:51:16 ago on Thu 03 Jun 2021 02:07:15 AM CST.
Dependencies resolved.
===============================================================================================================================================
 Package                             Architecture           Version                                            Repository                 Size
===============================================================================================================================================
Installing:
 net-snmp                            x86_64                 1:5.8-18.el8_3.1                                   AppStream                 354 k
 net-snmp-utils                      x86_64                 1:5.8-18.el8_3.1                                   AppStream                 239 k
Upgrading:
 net-snmp-libs                       x86_64                 1:5.8-18.el8_3.1                                   BaseOS                    824 k
Installing dependencies:
 lm_sensors-libs                     x86_64                 3.4.0-21.20180522git70f7e08.el8                    BaseOS                     59 k
 net-snmp-agent-libs                 x86_64                 1:5.8-18.el8_3.1                                   AppStream                 747 k

Transaction Summary
===============================================================================================================================================
Install  4 Packages
Upgrade  1 Package

Total download size: 2.2 M
Downloading Packages:
(1/5): net-snmp-agent-libs-5.8-18.el8_3.1.x86_64.rpm                                                           2.5 MB/s | 747 kB     00:00    
(2/5): net-snmp-5.8-18.el8_3.1.x86_64.rpm                                                                      1.1 MB/s | 354 kB     00:00    
(3/5): lm_sensors-libs-3.4.0-21.20180522git70f7e08.el8.x86_64.rpm                                              801 kB/s |  59 kB     00:00    
(4/5): net-snmp-utils-5.8-18.el8_3.1.x86_64.rpm                                                                584 kB/s | 239 kB     00:00    
(5/5): net-snmp-libs-5.8-18.el8_3.1.x86_64.rpm                                                                 5.2 MB/s | 824 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                          4.7 MB/s | 2.2 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                       1/1 
  Upgrading        : net-snmp-libs-1:5.8-18.el8_3.1.x86_64                                                                                 1/6 
  Installing       : lm_sensors-libs-3.4.0-21.20180522git70f7e08.el8.x86_64                                                                2/6 
  Running scriptlet: lm_sensors-libs-3.4.0-21.20180522git70f7e08.el8.x86_64                                                                2/6 
  Installing       : net-snmp-agent-libs-1:5.8-18.el8_3.1.x86_64                                                                           3/6 
  Installing       : net-snmp-1:5.8-18.el8_3.1.x86_64                                                                                      4/6 
  Running scriptlet: net-snmp-1:5.8-18.el8_3.1.x86_64                                                                                      4/6 
  Installing       : net-snmp-utils-1:5.8-18.el8_3.1.x86_64                                                                                5/6 
  Cleanup          : net-snmp-libs-1:5.8-14.el8.x86_64                                                                                     6/6 
  Running scriptlet: net-snmp-libs-1:5.8-14.el8.x86_64                                                                                     6/6 
  Verifying        : net-snmp-1:5.8-18.el8_3.1.x86_64                                                                                      1/6 
  Verifying        : net-snmp-agent-libs-1:5.8-18.el8_3.1.x86_64                                                                           2/6 
  Verifying        : net-snmp-utils-1:5.8-18.el8_3.1.x86_64                                                                                3/6 
  Verifying        : lm_sensors-libs-3.4.0-21.20180522git70f7e08.el8.x86_64                                                                4/6 
  Verifying        : net-snmp-libs-1:5.8-18.el8_3.1.x86_64                                                                                 5/6 
  Verifying        : net-snmp-libs-1:5.8-14.el8.x86_64                                                                                     6/6 
Installed products updated.

Upgraded:
  net-snmp-libs-1:5.8-18.el8_3.1.x86_64                                                                                                        

Installed:
  lm_sensors-libs-3.4.0-21.20180522git70f7e08.el8.x86_64    net-snmp-1:5.8-18.el8_3.1.x86_64    net-snmp-agent-libs-1:5.8-18.el8_3.1.x86_64   
  net-snmp-utils-1:5.8-18.el8_3.1.x86_64                   

Complete!

三、修改SNMP相关配置文件

[root@IT-01 ~]# grep -Ev '^#|^$' /etc/snmp/snmpd.conf 
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
view    systemview    included   .1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes

四、重启snmp服务

[root@IT-01 ~]# systemctl start snmpd

五、测试收集信息

[root@IT-01 ~]# snmpwalk -v 2c -c public 127.0.0.1 sysname
SNMPv2-MIB::sysName.0 = STRING: IT-01

六、WEB配置

在这里插入图片描述

七、检查SNMP是否添加成功

在这里插入图片描述

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。