zabbix5.4.4部署
环境说明:
系统平台 | IP | 需要安装的服务 |
---|
contos7 | 192.168.47.128 | httpd mysql5.7.34 php7.4.24 zabbix5.4.4 |
安装顺序:
lamp>zabbix
安装lamp
略
[root@apache apache]
Server version: Apache/2.4.49 (Unix)
Server built: Sep 27 2021 09:42:08
[root@apache apache]
mysql Ver 14.14 Distrib 5.7.34, for linux-glibc2.12 (x86_64) using EditLine wrapper
[root@apache apache]
LISTEN 0 128 127.0.0.1:9000 0.0.0.0:*
cubic cwnd:10
LISTEN 0 128 *:80 *:*
cubic cwnd:10
LISTEN 0 80 *:3306 *:*
cubic cwnd:10
安装zabbix
//下载依赖包
[root@apache apache]
[root@apache apache]
//下载安装包
[root@apache src]
//解压
[root@apache src]
[root@apache src]
//创建mysql用户
[root@apache src]
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.34 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix123!';
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
导入库数据
[root@apache src]
[root@apache mysql]
data.sql double.sql images.sql Makefile.am Makefile.in schema.sql
[root@apache mysql]
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@apache mysql]
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@apache mysql]
mysql: [Warning] Using a password on the command line interface can be insecure.
//编译
[root@apache mysql]
--enable-server
--enable-agent
--with-mysql
--with-net-snmp
--with-libcurl
--with-libxml2
[root@apache zabbix-5.4.4]
zabbix服务端配置
[root@apache zabbix-5.4.4]
zabbix_agentd.conf zabbix_agentd.conf.d zabbix_server.conf zabbix_server.conf.d
//修改服务端配置文件
//设置数据库信息
[root@apache zabbix-5.4.4]
DBPassword=zabbix123! //设置zabbix数据库连接密码
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
cubic cwnd:10
LISTEN 0 128 127.0.0.1:9000 0.0.0.0:*
cubic cwnd:10
LISTEN 0 80 *:3306 *:*
cubic cwnd:10
LISTEN 0 128 *:80 *:*
如果发现启动不了10051端口,说明zabbix找不到mysql位置要手动指定,修改zabbix配置文件。
[root@apache zabbix-5.4.4]
DBSocket=/tmp/mysql.sock
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10051 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9000 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
Zabbix服务端web界面安装与配置
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
//将Zabbix目录中的前端网页复制到php存放网页的目录
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
aclocal.m4 compile config.sub depcomp Makefile missing ui
AUTHORS conf configure include Makefile.am NEWS zabbix.service
bin config.guess configure.ac INSTALL Makefile.in README
build config.log COPYING install-sh man sass
ChangeLog config.status database m4 misc src
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
//配置apache虚拟主机
[root@apache zabbix-5.4.4]
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs/zabbix"
ServerName www.hhr.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/
<Directory "/usr/local/apache/htdocs/zabbix">
Options none
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
//修改/usr/local/apache/htdocs/zabbix/conf的权限,这样才能自动生成数据库连接文件
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
[root@apache zabbix-5.4.4]
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@apache zabbix-5.4.4]
Shutting down MySQL.... SUCCESS!
Starting MySQL. SUCCESS!
[root@apache zabbix-5.4.4]
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10051 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9000 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
安装zabbix web界面
|