Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案,Zabbix能监视各类网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位,解决存在的各类问题;Zabbix主要由两部分构成,Zabbix server与可选组件Zabbix agent;
php
配置环境 html
OS:CentOS 7.5 64bit
Zabbix版本:3.4
PHP版本:7.2.8
MySQL版本:5.7.22
Nginx版本:1.14.0
hostname:zabbix-1-1
ip:10.18.43.141mysql
基础需求linux
[root@zabbix-1-1 ~]# systemctl stop firewalld [root@zabbix-1-1 ~]# sed -ri '/^SELINUX=*/cSELINUX=disabled' /etc/selinux/config [root@zabbix-1-1 ~]# setenforce 0 [root@zabbix-1-1 ~]# mkdir -p /date/zabbix [root@zabbix-1-1 ~]# groupadd zabbix [root@zabbix-1-1 ~]# useradd -r -g zabbix -s /sbin/nologin zabbix
依赖环境库下载:nginx
[root@zabbix-1-1 ~]# yum install net-snmp-devel libevent-devel mysql-devel -y
[root@zabbix-1-1 ~]# wget -P /data/zabbix https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.11/zabbix-3.4.11.tar.gz
[root@zabbix-1-1 ~]# cd /data/zabbix/ [root@zabbix-1-1 zabbix]# tar xf zabbix-3.4.11.tar.gz [root@zabbix-1-1 zabbix]# cd zabbix-3.4.11/
执行编译:sql
[root@zabbix-1-1 zabbix-3.4.11]# ./configure \
--enable-server \
--enable-agent \
--with-mysql \
--enable-ipv6 \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--prefix=/usr/local/zabbix [root@zabbix-1-1 zabbix-3.4.11]# make install
MySQL编译安装请参考:传送门数据库
[root@zabbix-1-1 ~]# mysql -p'Passwd@123'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1070
Server version: 5.7.22 Source distribution
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
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 default character set utf8; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'10.18.43.141' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'127.0.0.1' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'localhost' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'%' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
数据导入(注意导入数据的前后顺序,若是顺序错误,就会使数据导入不成功或者其它错误)vim
[root@zabbix-1-1 ~]# cd /data/zabbix/zabbix-3.4.11/database/mysql/ [root@zabbix-1-1 mysql]# mysql -u'zabbixadmin' -p'Zabbix@123' zabbix < schema.sql mysql: [Warning] Using a password on the command line interface can be insecure. [root@zabbix-1-1 mysql]# mysql -u'zabbixadmin' -p'Zabbix@123' zabbix < images.sql mysql: [Warning] Using a password on the command line interface can be insecure. [root@zabbix-1-1 mysql]# mysql -u'zabbixadmin' -p'Zabbix@123' zabbix < data.sql mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zabbix-1-1 ~]# vim /usr/local/zabbix/etc/zabbix_server.conf ### Option: LogFile # Log file name for LogType 'file' parameter. # # Mandatory: no # Default: # LogFile= LogFile=/tmp/zabbix_server.log #日志存放位置 ### Option: DBHost # Database host name. # If set to localhost, socket is used for MySQL. # If set to empty string, socket is used for PostgreSQL. # # Mandatory: no # Default: # DBHost=localhost DBHost=10.18.43.141 #数据库IP地址 ### Option: DBName # Database name. # For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored. # # Mandatory: yes # Default: # DBName= DBName=zabbix #数据库名称 ### Option: DBUser # Database user. Ignored for SQLite. # # Mandatory: no # Default: # DBUser= DBUser=zabbixadmin #数据库用户名称 ### Option: DBPassword # Database password. Ignored for SQLite. # Comment this line if no password is used. # # Mandatory: no # Default: # DBPassword= DBPassword=Zabbix@123 #数据库用户密码 ### Option: AlertScriptsPath # Full path to location of custom alert scripts. # Default depends on compilation options. # # Mandatory: no # Default: # AlertScriptsPath=${datadir}/zabbix/alertscripts AlertScriptsPath=/usr/local/zabbix/alertscripts #脚本存放位置
Nginx编译安装请参考:传送门安全
[root@zabbix-1-1 ~]# vim /usr/local/nginx/conf/nginx.conf
user nginx; #修改使用用户
http {
include /usr/local/nginx/conf/conf.d/*.conf; #添加子配置路径
}
[root@zabbix-1-1 ~]# vim /usr/local/nginx/conf/conf.d/zabbix.conf
server {
listen 80;
server_name _;
location / {
root /usr/local/nginx/html;
index index.php;
}
location ~ "\.php$" {
root /usr/local/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
}
PHP编译安装请参考:传送门服务器
[root@mysql-1-1 ~]# vim /usr/local/php/lib/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
访问本机IP地址:http://10.18.43.141/setup.php
确认以上填写的Web信息,继续下一步。图略。。。
没法自动下载配置文件,须要咱们手动下载。
下载后,刷新页面便可。
安装完成以后的界面,下次访问 http://10.18.43.141/zabbix.php