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