其他分享
首页 > 其他分享> > 部署Zabbix4.0和Grafana

部署Zabbix4.0和Grafana

作者:互联网

部署Zabbix4.0和Grafana

一、Zabbix

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

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
2、安装数据库

推荐直接使用centos的mariaDB,先进行数据库初始化

# 后面的yes/no自己甄别,推荐先不创建root密码
mysql_secure_installation
...
3、初始化数据库
# 进入数据库【password】为自定义密码
mysql
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by '【password】';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;

# 导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p【password】 zabbix

# 为Zabbix server配置数据库
vim /etc/zabbix/zabbix_server.conf
...
DBPassword=【password】
...
4、初始化zabbix-server
# 设置自己的时区
vim /etc/httpd/conf.d/zabbix.conf
...
php_value date.timezone Asia/Shanghai
...

# 启动Zabbix server和agent进程,并为它们设置开机自启
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd

# 连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix
# 然后按照网页上的提示进入zabbix
# 默认用户密码为:Admin/zabbix
5、创建一个zabbix-agent
# 这里使用yum安装
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
yum install -y zabbix-agent

# 修改agent配置文件中对应的server地址
vim /etc/zabbix/zabbix_agentd.conf 
...
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=

Server=对应的zabbix-server的ip
...

# 启动agent
systemctl start zabbix-agent
systemctl enable zabbix-agent
6、在server端添加zabbix-agent

image-20210508105813562

image-20210508105945937

image-20210508110139482

到此zabbix-server和zabbix-agent已经安装好了

二、Grafana

1、安装
wget https://dl.grafana.com/oss/release/grafana-7.5.5-1.x86_64.rpm
yum install grafana-7.5.5-1.x86_64.rpm
systemctl enable grafana-server.service
systemctl start grafana-server.service

浏览器打开3000端口,默认账户密码是admin/admin

image-20210508110753358

2、安装zabbix插件
grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server.service

插件中就会出现

image-20210508110934439

3、添加zabbix数据源

image-20210508111037090

image-20210508111116788

image-20210508111128164

image-20210508111142323

添加后即可

4、查看dashboard

image-20210508111256237

image-20210508111308835

标签:...,Grafana,部署,agent,server,zabbix,systemctl,mysql,Zabbix4.0
来源: https://www.cnblogs.com/obitoma/p/14744154.html