Linux
Nginx,MySQL,PHP/Python

zabbix4.0server与agent部署

今天用的zabbix官方源下载zabbix-web失败,手动改成阿里云

下载安装zabbix yum 源文件

[root@test yum.repos.d]# vi zabbix.repo


[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
#baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

下载安装zabbix服务端相关软件

[root@test server_t]# yum install -y zabbix-server-mysql zabbix-web-mysql httpd php mariadb-server

软件配置

vim /etc/zabbix/zabbix_server.conf
126行 DBPassword=zabbix
vim /etc/httpd/conf.d/zabbix.conf
21行 php_value date.timezone Asia/Shanghai

编写配置数据库服务

启动mariadb服务
[root@test ~]# systemctl start mariadb.service
创建zabbix库
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
创建管理用户
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
导入zabbix表信息
[root@test ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
[root@test ~]#

启动zabbix程序相关服务

[root@test ~]# systemctl start zabbix-server.service
[root@test ~]# systemctl start  httpd

登录zabbix页面进行设置

http://10.0.0.200/zabbix/setup.php

/etc/zabbix/web/zabbix.conf.php — 记录web页面初始化信息

username:Admin   password:zabbix 登录

zabbix-server部署完成

yum源scp到客户端

[root@test yum.repos.d]# scp zabbix.repo root@10.0.0.201:/etc/yum.repos.d
The authenticity of host '10.0.0.201 (10.0.0.201)' can't be established.
ECDSA key fingerprint is SHA256:WMZSU2HMAIqqIbu6anwGaMC+JtztqbkAsG5/x5FkZUQ.
ECDSA key fingerprint is MD5:1c:43:1c:9e:71:8e:00:6c:8b:22:53:d2:1c:3e:7b:72.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.201' (ECDSA) to the list of known hosts.
root@10.0.0.201's password: 
zabbix.repo 
下载agent
[root@test ~]# yum install -y zabbix-agent

编写客户端配置文件

[root@test ~]# vim /etc/zabbix/zabbix_agentd.conf
98行 Server=10.0.0.200   #server端的ip

启动zabbix-agent

[root@test ~]# systemctl start zabbix-agent.service 
[root@test ~]#

页面配置监控主机

配置-主机-创建主机

添加模板测试

更新后变绿色代表成功

查看最新数据

 

赞(0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

LNMP社群 不仅仅是技术

关于我们联系我们