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

本文涉及的产品
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、浏览器访问安装

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
4天前
|
运维 Linux Docker
ChatGLM3在Docker环境部署,Linux运维免打包多渠道统计如何实现
ChatGLM3在Docker环境部署,Linux运维免打包多渠道统计如何实现
|
4天前
|
运维 Linux Docker
ChatGLM3在Docker环境部署(1),Linux运维电话面试技巧
ChatGLM3在Docker环境部署(1),Linux运维电话面试技巧
|
6天前
|
缓存 监控 安全
zabbix服务器监控之了解agent的启动过程
zabbix服务器监控之了解agent的启动过程
8 0
|
6天前
|
运维 Kubernetes 持续交付
构建高效自动化运维体系:基于容器技术的持续集成与部署实践
【5月更文挑战第13天】 在现代软件开发周期中,持续集成(CI)和持续部署(CD)已成为提升开发效率、保障产品质量的关键环节。随着云计算和微服务架构的普及,容器技术如Docker和Kubernetes为运维领域带来了革命性的变革。本文旨在探讨如何利用容器技术构建一个高效、可靠的自动化运维体系,实现从代码提交到产品发布的全过程自动化管理。通过深入分析容器化技术的核心原理,结合实际案例,我们将阐述如何优化持续集成流程、确保自动化测试的覆盖率、以及实现无缝的持续部署。
26 2
|
6天前
|
关系型数据库 Java 数据库
docker部署postgresql数据库和整合springboot连接数据源
docker部署postgresql数据库和整合springboot连接数据源
21 0
|
6天前
|
运维 监控 Linux
如何在Linux上部署1Panel运维管理面板并远程访问内网进行操作
如何在Linux上部署1Panel运维管理面板并远程访问内网进行操作
31 0
如何在Linux上部署1Panel运维管理面板并远程访问内网进行操作
|
6天前
|
消息中间件 运维 监控
基于SaaS云部署、云计算的区域医院云HIS系统源码(运维管理+运营管理+综合监管)
医院云his系统采用主流成熟技术开发,B/S架构,软件结构简洁、代码规范易阅读,SaaS应用,全浏览器访问,前后端分离,多服务协同,服务可拆分,功能易扩展。多医院统一登录患者主索引建立、主数据管理,统一对外接口管理。
41 1
|
6天前
|
监控 前端开发
Zabbix使用外部邮箱服务器发送邮件报警
Zabbix使用外部邮箱服务器发送邮件报警
|
6天前
|
存储 分布式计算 Hadoop
基于Hadoop分布式数据库HBase1.0部署及使用
基于Hadoop分布式数据库HBase1.0部署及使用
|
6天前
|
存储 运维 Shell
Ansible自动化运维工具安装和基本使用
Ansible 是一款无代理的IT自动化工具,通过SSH连接目标主机执行配置管理、应用部署和云端管理任务。它使用YAML编写的Playbook定义任务,核心组件包括Playbook、模块、主机清单、变量等。Ansible的优势在于易用、功能强大、无须在目标主机安装额外软件,并且开源。安装过程涉及配置网络源、yum安装和SSH密钥设置。通过定义主机清单和使用模块进行通信测试,确保连接成功。
Ansible自动化运维工具安装和基本使用

推荐镜像

更多