Zabbix5系列-报表工具ZbxTable (十八)

一、参考
  • Zabbix5系列
二、环境

系统:Centos7.9
zabbix版本:5.4
nginx版本:1.20.1
mysql版本:5.7.37
ZbxTable版本:1.1.5

三、安装nginx、mysql
# 临时关闭SELinux
setenforce 0
# 永久关闭SELinux
# SELINUX=disabled
vi /etc/selinux/config
# 下载nginx
curl -O http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.20.1-1.el7.ngx.x86_64.rpm
# 安装nginx
rpm -ivh nginx-1.20.1-1.el7.ngx.x86_64.rpm
# 移除mariadb-libs
yum remove mariadb-libs
# 安装mysql依赖
yum install net-tools
yum install perl
# 下载mysql5.7.37
curl -O https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.37-1.el7.x86_64.rpm
curl -O https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.37-1.el7.x86_64.rpm
curl -O https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.37-1.el7.x86_64.rpm
curl -O https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.37-1.el7.x86_64.rpm
# 安装mysql5.7.37
rpm -ivh mysql-community-common-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.37-1.el7.x86_64.rpm
# 启动
systemctl start mysqld
systemctl enable mysqld
# 查看密码
cat /var/log/mysqld.log | grep password
# 使用查看到的密码登录数据库
mysql -u root -p
# 修改密码
set password = password("<password>");
# 退出数据库
quit;
四、安装 zbxtable
4.1 配置数据库 安装 初始化
# 下载zbxtable
curl -O https://repo.cactifans.com/zbxtable/1.0/rhel/7/x86_64/zbxtable-1.1.5-1.el7.x86_64.rpm
# 安装zbxtable
rpm -ivh zbxtable-1.1.5-1.el7.x86_64.rpm
# 登录mysql
mysql -u root -p
# 创建数据库zbxtable
create database zbxtable character set utf8 collate utf8_bin;
# 创建用户zbxtable@localhost  注意修改<password>
create user zbxtable@localhost identified by '<password>';
# 授权用户
grant all privileges on zbxtable.* to zbxtable@localhost;
# 退出数据库
quit;
# 进入zbxtable目录
cd /usr/local/zbxtable/
# 执行初始化
./zbxtable init
  • zbxtable初始化
MYSQL PG # 选择数据库
DBName: zbxtable # 数据库名
DBUser: zbxtable # 数据库用户名
DBPass: *********** # 数据库密码
DBPort: 3306 # 数据库端口
Connected to database zbxtable successfully!
Zabbix Web URL: http://172.25.53.131 # Zabbix访问地址
Zabbix Username: Admin # Zabbix用户名
Zabbix Password: ******* # Zabbix密码
Connected to Zabbix API successfully!Zabbix version is  5.4.8
# 信息确认
The configuration information is as follows:
ZbxTable dbtype: mysql
ZbxTable dbhost: localhost
ZbxTable dbname: zbxtable
ZbxTable dbuser: zbxtable
ZbxTable dbpass: ***********
ZbxTable dbport: 3306
Zabbix Web URL: http://172.25.53.131
Zabbix Username: Admin
Zabbix Password: *******
✔ Yes
The configuration file ./conf/app.conf is generated successfully!
4.2 配置nginx
# 开机自动启动并立即启动
systemctl enable --now zbxtable
# 查看服务状态
systemctl status zbxtable
# 复制nginx配置文件
cp /usr/local/zbxtable/nginx.conf /etc/nginx/conf.d/
# 重启nginx
systemctl restart nginx
# 开机自动启动nginx
systemctl ebable nginx
4.3 配置ms-agent
# 进入zbxtable目录
cd /usr/local/zbxtable/
# 配置ms-agent
# 创建msagent用户 动作 报警媒介等 执行前确保已成功配置zabbix
./zbxtable install
4.4 配置防火墙
# 放行8088端口
firewall-cmd --zone=public --add-port=8088/tcp --permanent
# 重载防火墙
firewall-cmd --reload
4.5 登录

使用 http://ip:8088 登录系统
系统默认账号:admin
密码:Zbxtable

五、安装MS-Agent(接收告警)

MS-Agent需要安装在Zabbix宿主机上 登录Zabbix宿主机

# 下载ms-agent
curl -O https://repo.cactifans.com/zbxtable/1.0/rhel/7/x86_64/ms-agent-1.0.3-1.el7.x86_64.rpm
# 安装ms-agent
rpm -ivh ms-agent-1.0.3-1.el7.x86_64.rpm
# 移动ms-agent至自定义报警脚本目录  默认:/usr/lib/zabbix/alertscripts/
mv /usr/lib/zabbix/alertscripts/ms-agent /opt/zabbix/alertscripts/
# 编辑ms-agent配置文件
# Host 为 ZbxTable 系统地址,默认为 http 服务器 IP+/v1/receive
# Token 与 ZbxTable 通信的 Token,可自行修改,需要与 ZbxTable 平台配置保持一致即可,否则无法接收告警
vi /etc/ms-agent/app.ini
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Halyace

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值