zabbix部署
zabbix部署
- 部署zabbix服务
- 被监测主机部署zabbix-agent2
使用版本
| 组件 | 版本 |
|---|---|
| centos | 7.9 |
| zabbix | 5.0 |
| php | 7.2.24 |
| MariaDB | 5.5.68 |
部署zabbix服务
关闭防火墙和selinux
[root@node ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)
[root@node ~]# getenforce
Disabled
获取zabbix的下载源
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
这边其实清空缓存就可以了
[root@node ~]# yum clean all
[root@node ~]# yum makecache
用于多版本环境使用(安装software Collections,避免php多版本冲突)
[root@node ~]# yum install centos-release-scl -y
查看源信息,这里使用的是国外源,想使用国内更换为阿里源
[root@node ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/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=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1[root@node ~]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo[root@node ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.aliyun.com/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.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
安装zabbix及配置mysql
[root@node ~]# yum install zabbix-server-mysql zabbix-agent -y
[root@node ~]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
[root@node ~]# yum install mariadb-server -y
[root@node ~]# systemctl enable --now mariadb
[root@node ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none):
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] Y... Success!Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] Y... Success!By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y... Success!Cleaning up...All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB![root@node ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (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)]>
MariaDB [(none)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> create user zabbix@localhost identified by 'mysql123';
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> exit;
Bye
[root@node ~]#
写入sql
[root@node ~]# zcat /usr/share/doc/zabbix-server-mysql-5.0.40/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@node ~]# mysql -u zabbix -p zabbix
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -AWelcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [zabbix]>
MariaDB [zabbix]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| zabbix |
+--------------------+
2 rows in set (0.00 sec)MariaDB [zabbix]> use zabbix;
Database changed
MariaDB [zabbix]>
MariaDB [zabbix]> exit;
Bye
修改配置
[root@node ~]# vi /etc/zabbix/zabbix_server.conf
[root@node ~]# cat /etc/zabbix/zabbix_server.conf | grep DB | grep -Ev "^#|^$"
DBName=zabbix
DBUser=zabbix
DBPassword=mysql123
[root@node ~]# vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
[root@node ~]# grep "timezone" /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
[root@node ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@node ~]#
网页查看http://ip/zabbix/setup.php

查看右面状态是否全为ok,若不是,检查相关配置

配置数据库信息

下来一直点到结束



用户名:Admin,密码:zabbix


被监测主机部署zabbix-agent2
zabbix-agent2是由go语言编写的。zabbix对时间要求比较高,所以需要做时间同步。
主机部署ntp服务,然后其他被监控主机(被节点)同步时间即可(如果是先有生产环境,再配置zabbix监控,可以反过来做。具体情况具体分析)
[root@node ~]# yum install ntpd -y
[root@node ~]# systemctl start ntpd
被节点操作
[root@node1 ~]# yum install ntpdate -y
[root@node1 ~]# ntpdate -d 服务端ip
安装zabbix-agent2
[root@node1 ~]# rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@node1 ~]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
[root@node1 ~]# yum install zabbix-agent2
修改配置文件
[root@node1 ~]# grep -Ev "^$|^#" /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server=主IP
ServerActive=主IP
Hostname=node1
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock
[root@node1 ~]# systemctl start zabbix-agent2
测试连通性
[root@node ~]# yum install zabbix-get -y
[root@node ~]# zabbix_get -s '172.26.138.68' -p 10050 -k 'agent.ping'
1
页面乱码解决,执行完后刷新页面即可
[root@node ~]# yum install wqy-microhei-fonts -y
[root@node ~]# \cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
相关文章:
zabbix部署
zabbix部署 部署zabbix服务被监测主机部署zabbix-agent2 使用版本 组件版本centos7.9zabbix5.0php7.2.24MariaDB5.5.68 部署zabbix服务 关闭防火墙和selinux [rootnode ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemonLoaded: …...
深入理解Java源码:提升技术功底,深度掌握技术框架,快速定位线上问题
为什么要看源码: 1、提升技术功底: 学习源码里的优秀设计思想,比如一些疑难问题的解决思路,还有一些优秀的设计模式,整体提升自己的技术功底 2、深度掌握技术框架: 源码看多了,对于一个新技术…...
寒假前端第一次作业
1、用户注册: <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>用户注册</title> …...
【LabVIEW FPGA入门】创建第一个LabVIEW FPGA程序
本教程仅以compactRIO(FPGA-RT)举例 1.系统配置 1.1软件安装 FPGA-RT 1. LabVIEW Development System (Full or Professional) 2. LabVIEW Real-Time Module 3. LabVIEW FPGA Module 4. NI-RIO drivers 1.2硬件配置 1.使用线缆连接CompactRIO至主机…...
【STM32】STM32学习笔记-USART串口数据包(28)
00. 目录 文章目录 00. 目录01. 串口简介02. HEX数据包03. 文本数据包04. HEX数据包接收05. 文本数据包接收06. 预留07. 附录 01. 串口简介 串口通讯(Serial Communication)是一种设备间非常常用的串行通讯方式,因为它简单便捷,因此大部分电子设备都支持…...
Java网络爬虫--HttpClient
目录标题 技术介绍有什么优点?怎么在项目中引入? 请求URLEntityUtils 类GET请求带参数的GET请求POST请求 总结 技术介绍 HttpClient 是 Apache Jakarta Common 下的子项目,用来提供高效的、功能丰富的、支持 HTTP 协议的客户端编程工具包。相…...
若依项目的table列表中对每一个字段增加排序按钮(单体版和前后端分离版)
一、目标:每一个字段都添加上下箭头用来排序 只需要更改前端代码,不需要更改后端代码,后面会讲解原理 二、单体版实现方式: 1.在options中添加sortable:true 2.在需要排序的字段中添加sortable:true 三、前后端分离版 1.el-table上添加@sort-change=“handleSortChange”…...
Linux自动化部署脚本
1:最近项目部署比较频繁终于熬不住了 就有下面的这东西 #!/bin/sh #报错停止运行 set -e # 获取tomcat的PID TOMCAT_PID$(ps -ef | grep tomcat | grep -v grep | awk {print $2}) # tomcat的启动文件位置 START_TOMCAT/mnt/tomcat/bin/startup.sh # 项目文件部署位置 PROJECT…...
lvgl修改图片大小上限
在lvgl中读取图片文件时,被读取的图片具有上限,也就是2048像素。这会造成两个非预期的结果: 超过2048像素的部分会被裁去。表示图片的结构体lv_img_t中的w和h变量值是图片像素被2048求余。例如,当一个图片高为2048像素时…...
阻止持久性攻击改善网络安全
MITRE ATT&CK框架是一个全球可访问的精选知识数据库,其中包含基于真实世界观察的已知网络攻击技术和策略。持久性是攻击者用来访问系统的众多网络攻击技术之一;在获得初始访问权限后,他们继续在很长一段时间内保持立足点,以窃取数据、修改…...
MFC与Qt多个控件响应统一响应消息处理
就目前使用C开发框架来说,今天来讲述下MFC框架下与Qt框架下,如何让多个控件响应统一消息处理方法。 功能:假设有5个按钮,需要响应同一个处理函数,该如何实现呢? Qt方式 开发环境:win10 VS201…...
Camunda rest api鉴权
对于rest api 不能没有限制的任何人随意调用,需要提供账号信息。 一:工作流引擎增加过滤器 /*** 对/engine-rest/*进行鉴权,防止非法攻击* 客户端调用需要配置用户凭证否则报错401* camunda.bpm.client.basic-auth.username* camunda.bpm.cl…...
【PostgreSQL】在DBeaver中实现序列、函数、视图、触发器设计
【PostgreSQL】在DBeaver中实现序列、函数、触发器、视图设计 基本配置一、序列1.1、序列使用1.1.1、设置字段为主键,数据类型默认整型1.1.2、自定义序列,数据类型自定义 1.2、序列延申1.2.1、理论1.2.2、测试1.2.3、小结 二、函数2.1、SQL直接创建2.1.1…...
PyQt5-小总结
之前学习PyQt5,然后那段时间想做一个桌面小程序,后来由于学习内容较多就做了一小部分,但是可以进行页面跳转。大家如果是初学者对Python感兴趣而且刚学数据库时可以看看代码,可能会有点启发。 效果: 登录进来是这&…...
vue父组件给子组件传值,子组件不渲染的原因及解决方法
父组件传递给子组件的数据,如果是一个复杂对象(例如一个数组或对象),那么子组件只会监听对象的引用而不是对象的内容。这意味着当对象的内容发生变化时,子组件不会更新。 解决: 1、在子组件使用 watch 监听…...
【数据库】MySQL锁
一、锁的基本概念 1、锁的定义 锁是协调多个进程或线程并发访问数据库资源的一种机制。 MySQL中的锁是在服务器层或者存储引擎层实现的,保证了数据访问的一致性与有效性。但加锁是消耗资源的,锁的各种操作,包括获得锁、检测锁是否已解除、…...
mongodb学习篇
目录 前言基本概念数据库-database集合-collection文档-document 部署mongodblinux安装mongodbdocker安装mongodb MongoDB Shell (mongosh)命令行工具mongodb可视化-mongodb-compass、mongo-expressmongodb配置文件mongodb库、集合、文档库基本操作集合基本操作文档的增删改查C…...
kubernetes存储类迁移-备份恢复
背景介绍 kubernetes集群最开始使用了nfs作为存储,随着后续使用过程中数据量逐渐增加,nfs存储性能逐步出现不足,现增加了基于csi的分布式块存储后,需要对原有基于nfs存储类下的pv迁移到新的存储类下。 测试环境 k8s集群版本&am…...
python智能手机芯片
在未来,python智能手机芯片的发展方向可能包括以下几个方面: 强化处理能力:随着智能手机功能的不断扩展和用户需求的增加,处理器的性能需求也在不断提升。未来的python智能手机芯片可能会加强处理器的核心数量和频率,以…...
混淆技术概论
混淆技术概论 引言 在逆向工程领域,混淆技术是一种非常重要的技术手段,通过打破人们的思维惯性,使得逆向分析变得更加困难。本文将会介绍混淆技术的概念、分类及其应用,以及如何使用IPA Guard进行iOS IPA重签名。 混淆技术概述…...
gte-base-zh开箱即用:Xinference部署与WebUI体验全流程
gte-base-zh开箱即用:Xinference部署与WebUI体验全流程 1. 引言:从模型到服务,一键开启文本嵌入之旅 如果你正在寻找一个强大且易于部署的中文文本嵌入模型,那么 gte-base-zh 绝对值得你关注。这个由阿里巴巴达摩院精心训练的模…...
PyMAVLink:无人机通信的Python桥梁——从入门到实践指南
PyMAVLink:无人机通信的Python桥梁——从入门到实践指南 【免费下载链接】pymavlink python MAVLink interface and utilities 项目地址: https://gitcode.com/gh_mirrors/py/pymavlink 如何通过PyMAVLink实现无人机高效通信? 解析MAVLink协议&a…...
智能预约引擎:多维度决策系统解决茅台预约效率与成功率难题
智能预约引擎:多维度决策系统解决茅台预约效率与成功率难题 【免费下载链接】campus-imaotai i茅台app自动预约,每日自动预约,支持docker一键部署 项目地址: https://gitcode.com/GitHub_Trending/ca/campus-imaotai 茅台预约如同管理…...
Verilog 硬件描述语言实战——组合逻辑电路的设计与优化
1. Verilog与组合逻辑电路基础 第一次接触Verilog时,我被它简洁的语法震惊了——这跟写C语言太像了!但真正用起来才发现,硬件描述语言和软件编程完全是两回事。Verilog最迷人的地方在于,它能让我们用代码"搭建"真实的数…...
Vue3项目实战:vue-cropper图片裁剪从安装到跨域问题全解决
Vue3项目实战:从零构建高性能图片裁剪系统与跨域解决方案 在当今Web应用中,图片处理已成为不可或缺的功能模块。无论是社交平台的用户头像上传、电商网站的商品图片编辑,还是内容管理系统的富媒体处理,都需要精准的图片裁剪能力。…...
收藏!程序员/小白必看:YouTube最优AI Agent学习渠道,附完整大模型学习路线
不管你是刚入门AI的编程小白,还是想转型AI大模型领域的程序员,都别再盲目找学习资源了!今天给大家整理了6个YouTube宝藏频道,从入门实操到原理深挖,从实战技巧到行业前沿,覆盖AI Agent全学习场景࿰…...
【程序员转型】开发者转型成为 AI 工程师指南,大模型入门到精通,收藏这篇就足够了!
本文为开发者转型 AI 工程师提供了必备技能与职业路径的全面指南。 AI 工程师的需求前所未有地高涨,成为科技领域增长最快的职业之一。该岗位融合了传统软件开发与机器学习能力,对开发者而言既是机遇,也是现有编程技能的自然进化。你可以在此…...
3.17复试学习
Sine之舞(进阶7)作者: Turbo时间限制: 1s章节: 递归问题描述最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功。所以他准备和奶牛们做一个“Sine之舞”的游戏,寓教于乐…...
注塑厂批次色差真相:福尔蒂工艺映射法实现ΔE<3量产稳定
最近有位做汽车内饰件的朋友跟我聊起一个很实际的问题:同一批订单,不同机台打出来的注塑件颜色总有点微妙差别,客户拿色卡一比,ΔE值动不动就超5,返工重做成了常态。他问我:“是不是原料母粒本身就不稳&…...
答辩现场系统跑不起来?这份演示环境准备清单救了我(附一键部署脚本)
计算机毕设答辩演示环境准备完全指南:本地部署、云服务器与Docker容器化方案对比 一、问题:为什么演示环境是答辩的"隐形杀手"? 每年答辩季,总有同学因为演示环境出问题而手忙脚乱: 本地环境依赖混乱&…...
