【运维知识进阶篇】zabbix5.0稳定版详解1(安装+部署+添加服务器+拆分数据库)(一)

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 【运维知识进阶篇】zabbix5.0稳定版详解1(安装+部署+添加服务器+拆分数据库)

本篇文章介绍zabbix监控,监控是对我们操作系统进行不间断的监控,这是软件生命周期非常重要的一环,可以做到事前告警,事后根据监控内容排查问题(金丝雀,监控重要指标),有问题的时候,运维需要管理运维债务(在软件开发过程中积累的一些技术债务)


监控内容

我们需要监控硬件(磁盘df -h,内存free,磁盘IO,负载CPU,网络),软件服务(端口、进程、状态),业务层面(监控业务数据,订单量,注册用户,充值用户),只要是有值,zabbix都能监控,核心功能就是自定义监控。

监控工具

zabbix 硬件 服务状态 自定义监控

Nagions 网络产品 交换机 路由器 中型大型公司使用

Cacti 流量

Open-Falcon 小米公司自研

prometheus 监控kubernetes docker,比zabbix更好

监控宝等等

Zabbix安装

服务端:10.0.0.71(配置与监控数量有关,企业中一般是8G内存,4核或6核)

客户端:10.0.0.7,10.0.0.8

系统版本为CentOS7.9

1、配置yum源

1. rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
2. yum clean all

2、安装zabbix服务

yum -y install zabbix-server-mysql zabbix-agent

3、安装scl源,更好兼容已经安装的软件包,避免把系统搞烂

yum -y install centos-release-scl

4、开启前端的仓库

1. [root@Zabbix ~]# cat /etc/yum.repos.d/zabbix.repo
2. [zabbix]
3. name=Zabbix Official Repository - $basearch
4. baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
5. enabled=1
6. gpgcheck=1
7. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
8. 
9. [zabbix-frontend]
10. name=Zabbix Official Repository frontend - $basearch
11. baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
12. enabled=1            #开这里
13. gpgcheck=1
14. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
15. 
16. [zabbix-debuginfo]
17. name=Zabbix Official Repository debuginfo - $basearch
18. baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/
19. enabled=0
20. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
21. gpgcheck=1
22. 
23. [zabbix-non-supported]
24. name=Zabbix Official Repository non-supported - $basearch
25. baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
26. enabled=1
27. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
28. gpgcheck=1

5、安装php和apache前端

yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl

6、安装mariadb

1. yum -y install mariadb-server
2. systemctl start mariadb
3. systemctl enable mariadb

7、配置zabbix数据库

1. [root@Zabbix ~]# mysql -uroot
2. Welcome to the MariaDB monitor.  Commands end with ; or \g.
3. Your MariaDB connection id is 2
4. Server version: 5.5.68-MariaDB MariaDB Server
5. 
6. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
7. 
8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
9. 
10. MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
11. Query OK, 1 row affected (0.00 sec)
12. 
13. MariaDB [(none)]> create user zabbix@localhost identified by 'zabbix';
14. Query OK, 0 rows affected (0.00 sec)
15. 
16. MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
17. Query OK, 0 rows affected (0.00 sec)
18. 
19. MariaDB [(none)]> set global log_bin_trust_function_creators = 1;
20. Query OK, 0 rows affected (0.00 sec)
21. 
22. MariaDB [(none)]> quit;
23. Bye

8、导入数据库,初始化数据

1. [root@Zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
2. Enter password: zabbix

可以进去检查一下

1. [root@Zabbix ~]# mysql -uroot
2. Welcome to the MariaDB monitor.  Commands end with ; or \g.
3. Your MariaDB connection id is 5
4. Server version: 5.5.68-MariaDB MariaDB Server
5. 
6. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
7. 
8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
9. 
10. MariaDB [(none)]> use zabbix
11. Reading table information for completion of table and column names
12. You can turn off this feature to get a quicker startup with -A
13. 
14. Database changed
15. MariaDB [zabbix]> show tables;
16. +----------------------------+
17. | Tables_in_zabbix           |
18. +----------------------------+
19. | acknowledges               |
20. | actions                    |
21. | alerts                     |
22. | application_discovery      |
23. | application_prototype      |
24. | application_template       |
25. | applications               |
26. | auditlog                   |
27. | auditlog_details           |
28. | autoreg_host               |
29. | conditions                 |
30. | config                     |
31. | config_autoreg_tls         |
32. | corr_condition             |
33. | corr_condition_group       |
34. | corr_condition_tag         |
35. | corr_condition_tagpair     |
36. | corr_condition_tagvalue    |
37. | corr_operation             |
38. | correlation                |
39. | dashboard                  |
40. | dashboard_user             |
41. | dashboard_usrgrp           |
42. | dbversion                  |
43. | dchecks                    |
44. | dhosts                     |
45. | drules                     |
46. | dservices                  |
47. | escalations                |
48. | event_recovery             |
49. | event_suppress             |
50. | event_tag                  |
51. | events                     |
52. | expressions                |
53. | functions                  |
54. | globalmacro                |
55. | globalvars                 |
56. | graph_discovery            |
57. | graph_theme                |
58. | graphs                     |
59. | graphs_items               |
60. | group_discovery            |
61. | group_prototype            |
62. | history                    |
63. | history_log                |
64. | history_str                |
65. | history_text               |
66. | history_uint               |
67. | host_discovery             |
68. | host_inventory             |
69. | host_tag                   |
70. | hostmacro                  |
71. | hosts                      |
72. | hosts_groups               |
73. | hosts_templates            |
74. | housekeeper                |
75. | hstgrp                     |
76. | httpstep                   |
77. | httpstep_field             |
78. | httpstepitem               |
79. | httptest                   |
80. | httptest_field             |
81. | httptestitem               |
82. | icon_map                   |
83. | icon_mapping               |
84. | ids                        |
85. | images                     |
86. | interface                  |
87. | interface_discovery        |
88. | interface_snmp             |
89. | item_application_prototype |
90. | item_condition             |
91. | item_discovery             |
92. | item_preproc               |
93. | item_rtdata                |
94. | items                      |
95. | items_applications         |
96. | lld_macro_path             |
97. | lld_override               |
98. | lld_override_condition     |
99. | lld_override_opdiscover    |
100. | lld_override_operation     |
101. | lld_override_ophistory     |
102. | lld_override_opinventory   |
103. | lld_override_opperiod      |
104. | lld_override_opseverity    |
105. | lld_override_opstatus      |
106. | lld_override_optag         |
107. | lld_override_optemplate    |
108. | lld_override_optrends      |
109. | maintenance_tag            |
110. | maintenances               |
111. | maintenances_groups        |
112. | maintenances_hosts         |
113. | maintenances_windows       |
114. | mappings                   |
115. | media                      |
116. | media_type                 |
117. | media_type_message         |
118. | media_type_param           |
119. | module                     |
120. | opcommand                  |
121. | opcommand_grp              |
122. | opcommand_hst              |
123. | opconditions               |
124. | operations                 |
125. | opgroup                    |
126. | opinventory                |
127. | opmessage                  |
128. | opmessage_grp              |
129. | opmessage_usr              |
130. | optemplate                 |
131. | problem                    |
132. | problem_tag                |
133. | profiles                   |
134. | proxy_autoreg_host         |
135. | proxy_dhistory             |
136. | proxy_history              |
137. | regexps                    |
138. | rights                     |
139. | screen_user                |
140. | screen_usrgrp              |
141. | screens                    |
142. | screens_items              |
143. | scripts                    |
144. | service_alarms             |
145. | services                   |
146. | services_links             |
147. | services_times             |
148. | sessions                   |
149. | slides                     |
150. | slideshow_user             |
151. | slideshow_usrgrp           |
152. | slideshows                 |
153. | sysmap_element_trigger     |
154. | sysmap_element_url         |
155. | sysmap_shape               |
156. | sysmap_url                 |
157. | sysmap_user                |
158. | sysmap_usrgrp              |
159. | sysmaps                    |
160. | sysmaps_elements           |
161. | sysmaps_link_triggers      |
162. | sysmaps_links              |
163. | tag_filter                 |
164. | task                       |
165. | task_acknowledge           |
166. | task_check_now             |
167. | task_close_problem         |
168. | task_data                  |
169. | task_remote_command        |
170. | task_remote_command_result |
171. | task_result                |
172. | timeperiods                |
173. | trends                     |
174. | trends_uint                |
175. | trigger_depends            |
176. | trigger_discovery          |
177. | trigger_tag                |
178. | triggers                   |
179. | users                      |
180. | users_groups               |
181. | usrgrp                     |
182. | valuemaps                  |
183. | widget                     |
184. | widget_field               |
185. +----------------------------+
186. 166 rows in set (0.00 sec)

9、再次配置数据库

1. [root@Zabbix ~]# mysql -uroot
2. Welcome to the MariaDB monitor.  Commands end with ; or \g.
3. Your MariaDB connection id is 8
4. Server version: 5.5.68-MariaDB MariaDB Server
5. 
6. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
7. 
8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
9. 
10. MariaDB [(none)]> set global log_bin_trust_function_creators = 0;
11. Query OK, 0 rows affected (0.00 sec)
12. 
13. MariaDB [(none)]> quit
14. Bye

10、修改zabbix连接数据库的信息

1. [root@Zabbix ~]# egrep ^DB /etc/zabbix/zabbix_server.conf
2. DBName=zabbix
3. DBUser=zabbix
4. DBPassword=zabbix    #取消注释

11、修改时区

1. [root@Zabbix ~]# tail -1 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
2. php_value[date.timezone] = Asia/Shanghai

12、启动zabbix进程

1. [root@Zabbix ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
2. [root@Zabbix ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

13、浏览器访问安装

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
1月前
|
弹性计算 Ubuntu Linux
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS自动化部署。支持Ubuntu 22.04/20.04、CentOS 7.7-7.9及Alibaba Cloud Linux 3.2104 LTS。前提条件:ECS实例需运行中且有公网。步骤:选择Docker扩展并安装,验证成功通过命令`docker -v`查看版本号。
297 79
|
6天前
|
存储 SQL 关系型数据库
服务器数据恢复—云服务器上mysql数据库数据恢复案例
某ECS网站服务器,linux操作系统+mysql数据库。mysql数据库采用innodb作为默认存储引擎。 在执行数据库版本更新测试时,操作人员误误将在本来应该在测试库执行的sql脚本在生产库上执行,导致生产库上部分表被truncate,还有部分表中少量数据被delete。
46 25
|
24天前
|
JavaScript NoSQL Java
基于SpringBoot+Vue实现的大学生就业服务平台设计与实现(系统源码+文档+数据库+部署等)
面向大学生毕业选题、开题、任务书、程序设计开发、论文辅导提供一站式服务。主要服务:程序设计开发、代码修改、成品部署、支持定制、论文辅导,助力毕设!
62 6
|
24天前
|
JavaScript NoSQL Java
基于SpringBoot+Vue的班级综合测评管理系统设计与实现(系统源码+文档+数据库+部署等)
✌免费选题、功能需求设计、任务书、开题报告、中期检查、程序功能实现、论文辅导、论文降重、答辩PPT辅导、会议视频一对一讲解代码等✌
40 4
|
24天前
|
JavaScript NoSQL Java
基于SpringBoot+Vue实现的大学生体质测试管理系统设计与实现(系统源码+文档+数据库+部署)
面向大学生毕业选题、开题、任务书、程序设计开发、论文辅导提供一站式服务。主要服务:程序设计开发、代码修改、成品部署、支持定制、论文辅导,助力毕设!
36 2
|
1月前
|
运维
阿里云服务器批量执行命令(系统运维管理oos)
阿里云【系统运维管理oos】批量执行详情
50 5
|
1月前
|
弹性计算 运维 Ubuntu
使用阿里云服务器自动搭建WordPress网站流程,超简单by系统运维管理OOS
本教程介绍如何使用阿里云服务器(ECS)和系统运维管理OOS自动搭建WordPress网站,支持Ubuntu、CentOS及Alibaba Cloud Linux等操作系统。前提条件包括ECS实例处于运行中、有公网IP且安全组已开启80端口。安装步骤简单:进入ECS快速购买控制台选择预装WordPress,确认下单后通过管理控制台查看实例详情并开放安全组端口。最后,通过实例公网IP访问,出现WordPress登录页即表示安装成功。
|
24天前
|
JavaScript NoSQL Java
基于SpringBoot+Vue实现的冬奥会科普平台设计与实现(系统源码+文档+数据库+部署)
面向大学生毕业选题、开题、任务书、程序设计开发、论文辅导提供一站式服务。主要服务:程序设计开发、代码修改、成品部署、支持定制、论文辅导,助力毕设!
40 0
|
2天前
|
存储 机器学习/深度学习 人工智能
2025年阿里云GPU服务器租用价格、选型策略与应用场景详解
随着AI与高性能计算需求的增长,阿里云提供了多种GPU实例,如NVIDIA V100、A10、T4等,适配不同场景。2025年重点实例中,V100实例GN6v单月3830元起,适合大规模训练;A10实例GN7i单月3213.99元起,适用于混合负载。计费模式有按量付费和包年包月,后者成本更低。针对AI训练、图形渲染及轻量级推理等场景,推荐不同配置以优化成本和性能。阿里云还提供抢占式实例、ESSD云盘等资源优化策略,支持eRDMA网络加速和倚天ARM架构,助力企业在2025年实现智能计算的效率与成本最优平衡。 (该简介为原文内容的高度概括,符合要求的字符限制。)
|
3天前
|
存储 弹性计算 人工智能
2025年阿里云企业云服务器ECS选购与配置全攻略
本文介绍了阿里云服务器的核心配置选择方法论,涵盖算力需求分析、网络与存储设计、地域部署策略三大维度。针对不同业务场景,如初创企业官网和AI模型训练平台,提供了具体配置方案。同时,详细讲解了购买操作指南及长期运维优化建议,帮助用户快速实现业务上云并确保高效运行。访问阿里云官方资源聚合平台可获取更多最新产品动态和技术支持。

热门文章

最新文章

推荐镜像

更多