监控-Zabbix5.0-LTS之初体验(监控器监视端下载)
mhr18 2024-09-26 14:28 24 浏览 0 评论
参考zabbix官网:
https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=nginx
# 修改主机名
[root@template ~]# hostnamectl set-hostname zabbix-server
[root@template ~]# bash
################################################################
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 48G 3.6G 45G 8% /
/dev/sda1 297M 148M 150M 50% /boot
################################################################
zabbix-server_192.168.209.132 _root
################################################################
[root@zabbix-server ~]#
# 安装MySQL
[root@zabbix-server ~]# mkdir -p /opt/software
[root@zabbix-server ~]# cd /opt/software
[root@zabbix-server software]# rz -E
rz waiting to receive.
[root@zabbix-server software]# ls
mysql-5.7.31-1.el7.x86_64.rpm-bundle.tar
[root@zabbix-server software]# mkdir mysql_rpm
[root@zabbix-server software]# tar -xf mysql-5.7.31-1.el7.x86_64.rpm-bundle.tar -C mysql_rpm/
[root@zabbix-server software]# ls mysql_rpm/
mysql-community-client-5.7.31-1.el7.x86_64.rpm mysql-community-embedded-compat-5.7.31-1.el7.x86_64.rpm mysql-community-server-5.7.31-1.el7.x86_64.rpm
mysql-community-common-5.7.31-1.el7.x86_64.rpm mysql-community-embedded-devel-5.7.31-1.el7.x86_64.rpm mysql-community-test-5.7.31-1.el7.x86_64.rpm
mysql-community-devel-5.7.31-1.el7.x86_64.rpm mysql-community-libs-5.7.31-1.el7.x86_64.rpm
mysql-community-embedded-5.7.31-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm
[root@zabbix-server software]# yum localinstall -y mysql_rpm/*
# 修改数据库root密码
[root@zabbix-server software]# systemctl start mysqld
[root@zabbix-server software]# systemctl enable mysqld
[root@zabbix-server software]# egrep "passw" /var/log/mysqld.log
2021-04-02T09:30:04.359504Z 1 [Note] A temporary password is generated for root@localhost: !jcfw#%qD7u=
[root@zabbix-server software]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER "root"@"localhost" IDENTIFIED BY "P@ssw0rd";
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@zabbix-server software]#
# 安装zabbix5.0镜像源;修改为国内镜像源
[root@zabbix-server software]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.IJME9d: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-5.0-1.el7 ################################# [100%]
[root@zabbix-server software]# ls /etc/yum.repos.d/
CentOS-Base.repo epel.repo nginx.repo repo_bak zabbix.repo
[root@zabbix-server software]# vim /etc/yum.repos.d/zabbix.repo
[root@zabbix-server software]# vim /etc/yum.repos.d/zabbix.repo
[root@zabbix-server software]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
[root@zabbix-server software]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras nginx updates zabbix zabbix-non-supported
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@zabbix-server software]#
# 安装zabbix的server和agent
[root@zabbix-server software]# yum install -y zabbix-server-mysql zabbix-agent
# 安装zabbix的frontend;将zabbix.repo文件中[zabbix-frontend]的enabled的值设置为1
[root@zabbix-server software]# yum install centos-release-scl -y
[root@zabbix-server software]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-SCLo-scl-rh.repo nginx.repo zabbix.repo
CentOS-SCLo-scl.repo epel.repo repo_bak
[root@zabbix-server software]# vim /etc/yum.repos.d/zabbix.repo
[root@zabbix-server software]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
[root@zabbix-server software]# egrep zabbix-frontend /etc/yum.repos.d/zabbix.repo -A 5
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[root@zabbix-server software]# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl -y
# 创建初始数据库
[root@zabbix-server software]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> create user zabbix@localhost identified by 'P@ssw0rd';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@zabbix-server software]#
# 导入初始架构和数据,系统将提示您输入新创建的密码;并校验导入情况
[root@zabbix-server software]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@zabbix-server software]# mysql -uzabbix -p zabbix -e "show tables"
Enter password:
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
| application_discovery |
| application_prototype |
| application_template |
| applications |
| auditlog |
| auditlog_details |
| autoreg_host |
| conditions |
| config |
| config_autoreg_tls |
| corr_condition |
| corr_condition_group |
| corr_condition_tag |
| corr_condition_tagpair |
| corr_condition_tagvalue |
| corr_operation |
| correlation |
| dashboard |
| dashboard_user |
| dashboard_usrgrp |
| dbversion |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| event_recovery |
| event_suppress |
| event_tag |
| events |
| expressions |
| functions |
| globalmacro |
| globalvars |
| graph_discovery |
| graph_theme |
| graphs |
| graphs_items |
| group_discovery |
| group_prototype |
| history |
| history_log |
| history_str |
| history_text |
| history_uint |
| host_discovery |
| host_inventory |
| host_tag |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_templates |
| housekeeper |
| hstgrp |
| httpstep |
| httpstep_field |
| httpstepitem |
| httptest |
| httptest_field |
| httptestitem |
| icon_map |
| icon_mapping |
| ids |
| images |
| interface |
| interface_discovery |
| interface_snmp |
| item_application_prototype |
| item_condition |
| item_discovery |
| item_preproc |
| item_rtdata |
| items |
| items_applications |
| lld_macro_path |
| lld_override |
| lld_override_condition |
| lld_override_opdiscover |
| lld_override_operation |
| lld_override_ophistory |
| lld_override_opinventory |
| lld_override_opperiod |
| lld_override_opseverity |
| lld_override_opstatus |
| lld_override_optag |
| lld_override_optemplate |
| lld_override_optrends |
| maintenance_tag |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| mappings |
| media |
| media_type |
| media_type_message |
| media_type_param |
| module |
| opcommand |
| opcommand_grp |
| opcommand_hst |
| opconditions |
| operations |
| opgroup |
| opinventory |
| opmessage |
| opmessage_grp |
| opmessage_usr |
| optemplate |
| problem |
| problem_tag |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| rights |
| screen_user |
| screen_usrgrp |
| screens |
| screens_items |
| scripts |
| service_alarms |
| services |
| services_links |
| services_times |
| sessions |
| slides |
| slideshow_user |
| slideshow_usrgrp |
| slideshows |
| sysmap_element_trigger |
| sysmap_element_url |
| sysmap_shape |
| sysmap_url |
| sysmap_user |
| sysmap_usrgrp |
| sysmaps |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| tag_filter |
| task |
| task_acknowledge |
| task_check_now |
| task_close_problem |
| task_data |
| task_remote_command |
| task_remote_command_result |
| task_result |
| timeperiods |
| trends |
| trends_uint |
| trigger_depends |
| trigger_discovery |
| trigger_tag |
| triggers |
| users |
| users_groups |
| usrgrp |
| valuemaps |
| widget |
| widget_field |
+----------------------------+
[root@zabbix-server software]#
# 为Zabbix server配置数据库
[root@zabbix-server software]# vim /etc/zabbix/zabbix_server.conf
[root@zabbix-server software]# egrep ^DBPassword /etc/zabbix/zabbix_server.conf
DBPassword=P@ssw0rd
[root@zabbix-server software]#
# 为Zabbix前端配置PHP
# 去掉注释,写上IP地址
[root@zabbix-server software]# vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
[root@zabbix-server software]# egrep listen /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf -A 1
listen 80;
server_name 192.168.209.132;
[root@zabbix-server software]#
# 添加nginx用户
[root@zabbix-server software]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
[root@zabbix-server software]# egrep listen.acl /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
[root@zabbix-server software]#
# 去掉注释,修改时区
[root@zabbix-server software]# egrep timezone /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
[root@zabbix-server software]#
# 启动Zabbix server和agent进程,并为它们设置开机自启:
[root@zabbix-server software]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
[root@zabbix-server software]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
[root@zabbix-server software]#
配置Zabbix前端
http://192.168.209.132
[root@zabbix-server ~]# grep zabbix /etc/httpd/conf.d/zabbix.conf
grep: /etc/httpd/conf.d/zabbix.conf: No such file or directory
[root@zabbix-server ~]# grep zabbix /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
root /usr/share/zabbix;
fastcgi_pass unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock;
# fastcgi_pass unix:/var/opt/rh/rh-php73/run/php-fpm/zabbix.sock;
fastcgi_param DOCUMENT_ROOT /usr/share/zabbix;
fastcgi_param SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;
[root@zabbix-server ~]# find /usr/share/zabbix -iname *.ttf
/usr/share/zabbix/assets/fonts/graphfont.ttf
[root@zabbix-server ~]#
[root@zabbix-server ~]# rz -E
rz waiting to receive.
[root@zabbix-server ~]# ls
anaconda-ks.cfg original-ks.cfg SIMKAI.TTF
[root@zabbix-server ~]# mv SIMKAI.TTF /usr/share/zabbix/assets/fonts/graphfont.ttf
mv: overwrite ‘/usr/share/zabbix/assets/fonts/graphfont.ttf’? y
[root@zabbix-server ~]#
相关推荐
- Springboot数据访问(整合动态数据源)
-
Springboot整合动态数据源dynamic-datasource-spring-boot-starter基本概念这个依赖是MyBatis-Plus团队开发的动态数据源组件,它是一个基于Spri...
- 《有手就会写sql》-第1章 数据库(sql实时更新同表里某个字段的数据)
-
为啥要用数据库存放数据的方式,有很多种,常用的比如:excel,数据库等。有了excel,为啥还要用数据库呢?原因有很多。其中之一:excel存储的数据有限的,最多能存个几千万条。但一个银行的交易数据...
- DBdoctor:一款企业级数据库性能诊断工具
-
DBdoctor是一个全面覆盖开发、测试、运维等各个环节SQL审核以及数据库性能诊断与优化的监控平台。针对数据库性能诊断门槛高、耗时长的问题,DBdoctor提供了快速易用的解决方案,深入到数...
- 面试必问:MySQL死锁 是什么,如何解决?(史上最全)
-
MySQL死锁接触少,但面试又经常被问到怎么办?最近有小伙伴在面试的时候,被问了MySQL死锁,如何解决?虽然也回答出来了,但是不够全面体系化,所以,小北给大家做一下系统化、体系化的梳理,帮助大家在面...
- JAVA入门教程-第1章 概述(java入门篇)
-
大道至简-JAVA入门教程在本教程中,你将学习Java语言的基础知识。Java基础内容涵盖:Java基础概念、Java词法结构、Java数组、Java流程控制、Java字符串、Java...
- 突发消息!微软停止俄罗斯业务(微软停止服务怎么办)
-
越来越多的IT公司加入封杀俄罗斯的阵营中。数字化转型网先后关注的有(点击下方蓝字可打开文章):SAP停止俄罗斯所有业务乌克兰呼吁SAP、Oracle封杀俄罗斯,Oracle已停止在俄所有业务埃森哲停止...
- 分布式数据库设计——存储引擎原理(全)
-
摘要数据库的一个首要目标是可靠并高效地管理数据,以供人们使用。进而不同的应用可以使用相同的数据库来共享它们的数据。数据库的出现使人们放弃了为每个独立的应用开发数据存储的想法,同时,随着数据库广泛的使用...
- Java运行环境配置(java运行环境配置成功截图)
-
若要在计算机上运行Java程序,需要配置Java运行环境(JRE)或Java开发工具包(JDK)。以下是在Windows操作系统上配置Java运行环境的步骤:下载Java安装程序:前往Oracle官方...
- 分布式任务调度Celery(分布式任务调度平台)
-
本文介绍了分布式任务调度系统Celery,包括安装,开发使用,并且配合supervisor,flower等工具进行系统化部署和使用。(一)安装和代码开发使用示例一,简介Celery是一个分布式任务调度...
- Android SDK 安装与配置(android sdk安装在哪里)
-
AndroidSDK安装与配置全流程指南一、前期准备与环境要求1.系统兼容性验证o操作系统:支持Windows10/11(64位)、macOS10.14+、Ubuntu16.04+等主流...
- 高性能Linux服务器构建实战:运维监控、性能调优与集群应用
-
百万级字迹详解实战案例,篇幅因素故只展现pdf目录,完整解析获取方式在篇尾了!目录读者对象Web应用篇(1至第3章)数据备份恢复篇(4至第6章)网络存储应用篇(7和第8章)运维监控与性能优化篇(9和第...
- Vmware虚拟机迁移数据库时踩过的坑
-
从Vmware迁移数据库虚拟机到其他平台,起来后认不到asm盘,不禁傻眼了。很多时候为了保证虚拟机系统的完整可启动,在做任何变更前,领导都会要求克隆一份镜像保存,或者直接在镜像上操作。这是传统的备份理...
- Java 中 java.util.Date 与 java.sql.Date 有什么区别?
-
Java里的java.util.Date和java.sql.Date绝对是那种看起来不起眼但能搞得你Debug到半夜的“坑王”。我们先从表面上看,java.sql.Date是继承自j...
- 主流数据库的不同点在哪?MySQL和SQL Server的区别介绍
-
在本教程中,树懒君介绍了两种最普遍应用的RDBMS—MySQL和MicrosoftSQLServer。通过介绍MySQL和SQLServer的几个关键区别,希望大家能在这两者之间做出最适合自己的...
- Java安全-Java Vuls(Fastjson、Weblogic漏洞复现)
-
复现几个Java的漏洞,文章会分多篇这是第一篇,文章会分组件和中间件两个角度进行漏洞复现复现使用环境VulhubVulFocus组件Fastjson1.2.24反序列化RCEFastJson...
你 发表评论:
欢迎- 一周热门
- 最近发表
- 标签列表
-
- oracle位图索引 (74)
- oracle批量插入数据 (65)
- oracle事务隔离级别 (59)
- oracle 空为0 (51)
- oracle主从同步 (56)
- oracle 乐观锁 (51)
- redis 命令 (78)
- php redis (88)
- redis 存储 (66)
- redis 锁 (69)
- 启动 redis (66)
- redis 时间 (56)
- redis 删除 (67)
- redis内存 (57)
- redis并发 (52)
- redis 主从 (69)
- redis 订阅 (51)
- redis 登录 (54)
- redis 面试 (58)
- 阿里 redis (59)
- redis 搭建 (53)
- redis的缓存 (55)
- lua redis (58)
- redis 连接池 (61)
- redis 限流 (51)