一、簡介
1、什么是zabbix
zabbix是一個企業級的、開源的、分布式的監控套件。
zabbix可以對網絡和服務進行完整性,健康性的監控。zabbix利用靈活的告警機制,可以實驗微信,短信和郵件自動報警,zabbix利用存儲的監控數據提供監控報告及實現圖形化顯示。
zabbix支持主動輪詢和被動捕獲,zabbix所有的報告、統計信息和配置參數都可以通過基於web的前端頁面可以確保您從任何方面評估您的網絡狀態和服務器健康性
重要的是zabbix還是免費的。
2、zabbix特性
zabbix是一個高度集成的網絡監控套件,通過一個軟件包即可提供如下特性
數據收集
可用性和性能檢查
支持SNMP(包括捕獲和主動輪訓),IPMI,JMX,VMware監控
自定義檢查
按照自定義的間隔收集需要的數據
靈活的閾值定義
可以非常靈活的定義問題閾值,稱之為觸發器,觸發器從后端數據庫獲取參考值
高級告警配置
可以根據升級計划,接收方和媒體類型來定制發送告警通知,使用宏變量可以是告警通知更有意義更高效,自動化動作包含執行遠程命令
實時繪圖
使用內置圖表繪制功能可以將監控項的內容立即繪制成圖表
擴展的圖形化顯示
能夠自定義圖形,圖像中可將多個監控項組合在一個視圖展示
網絡拓撲圖
以儀表盤的樣式展現自定義的展現和幻燈片
報告
監控資源高級(業務)視圖
歷史數據存儲
數據存儲在數據庫中
可配置歷史數據
內置數據管理機制
配置簡單
將被監控對象添加為主機
主機被創建用於監控,在數據庫中是唯一的
應用模板來監控設備
模板使用
在模板中分組檢查
模板可以關聯其他模板
網絡自動發現
自動發現網絡設備
監控代理自動注冊
發現文件系統,網絡接口和snmp oid 值
簡介的web界面
web前端基於php
可從任何地方訪問
你可以定制自己的操作方式
審核日志
API
提供了對外的可編程接口,用於批量操作,第三方軟件集成和其他目的
權限管理系統
安全用戶認證
特定用戶可以限制訪問特定視圖
功能強大並易於擴展的監控代理
部署在被監控對象上
可以部署在linux和windows上
二進制代碼
為了性能和更少內存的占用,用c語言編寫
便於移植
為復雜環境准備
使用zabbix proxy代理服務器,使得遠程監控更簡單
3、zabbix監控組件及流程
主要由三大部分組成zabbix server,zabbix proxy,agent客戶端
zabbix server包括web GUI、database、zabbix server。
監控組件圖示如下:

zabbix監控流程如下圖:

zabbix監控的完整流程,agent安裝在被監控的主機上,agent負責定期收集客戶端各項數據,並發送到zabbix server端,zabbix server收到數據,將數據存儲到數據庫中,用戶基於zabbix web 可以看到數據在前端展現的圖像。
4、zabbix官方文檔
https://www.zabbix.com/documentation/4.0/zh/manual/quickstart/login
二、開始安裝並配置
1、架構

2、環境
zabbix server :192.168.216.51
zabbix mysql: 192.168.216.52
zabbix agent: 192.168.216.53
3、web1安裝軟件,linux+nginx+php
配置好epel源,zabbix源及關閉selinux,firewall
1 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #下載最新的base 2 yum install epel-release #安裝epel 3 yum install http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm #安裝zabbix
各軟件版本
2.1、安裝nginx
51 上部署nginx,zabbx,php-fpm
zabbix-server-mysql #主程序包及數據庫文件
zabbix-web-mysql #Zabbix的web端會通過這些數據,來展示繪圖
zabbix-get #為了便於agent端發起測試采集數據請求用得
一些依賴的作用
OpenIPMI-libs #即智能平台管理
iksemel #跨平台XML解析器
fping #用於向網絡主機發送ICMP回應請求
1 yum install nginx -y 2 yum install zabbix-server-mysql zabbix-web-mysql zabbix-get 3 yum install -y php php-devel php-fpm php-mysql php-common php-devel php-gd libjpeg* php-imap php-
ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel
各軟件版本
1 [root@web1 yum.repos.d]# rpm -qa |grep zabbix 2 zabbix-release-4.0-1.el7.noarch 3 zabbix-server-mysql-4.0.4-1.el7.x86_64 4 zabbix-web-mysql-4.0.4-1.el7.noarch 5 zabbix-web-4.0.4-1.el7.noarch 6 zabbix-get-4.0.4-1.el7.x86_64 7 [root@web1 yum.repos.d]# rpm -qa |grep zabbix 8 zabbix-release-4.0-1.el7.noarch 9 zabbix-server-mysql-4.0.4-1.el7.x86_64 10 zabbix-web-mysql-4.0.4-1.el7.noarch 11 zabbix-web-4.0.4-1.el7.noarch 12 zabbix-get-4.0.4-1.el7.x86_64 13 [root@web1 yum.repos.d]# rpm -qa |grep php* 14 php-process-5.4.16-46.el7.x86_64 15 php-ldap-5.4.16-46.el7.x86_64 16 php-xml-5.4.16-46.el7.x86_64 17 hyphen-2.8.6-5.el7.x86_64 18 php-mysql-5.4.16-46.el7.x86_64 19 php-mcrypt-5.4.16-7.el7.x86_64 20 libmspack-0.5-0.4.alpha.el7.x86_64 21 php-gd-5.4.16-46.el7.x86_64 22 php-bcmath-5.4.16-46.el7.x86_64 23 php-pear-1.9.4-21.el7.noarch 24 plymouth-graphics-libs-0.8.9-0.26.20140113.el7.centos.x86_64 25 php-mbstring-5.4.16-46.el7.x86_64 26 php-pdo-5.4.16-46.el7.x86_64 27 php-imap-5.4.16-7.el7.x86_64 28 php-xmlrpc-5.4.16-46.el7.x86_64 29 libreoffice-graphicfilter-5.0.6.2-3.el7.x86_64 30 gvfs-gphoto2-1.22.4-8.el7.x86_64 31 graphite2-1.3.6-1.el7_2.x86_64 32 php-common-5.4.16-46.el7.x86_64 33 php-odbc-5.4.16-46.el7.x86_64 34 php-fpm-5.4.16-46.el7.x86_64 35 libgphoto2-2.5.2-3.el7.x86_64 36 php-5.4.16-46.el7.x86_64 37 php-devel-5.4.16-46.el7.x86_64 38 php-cli-5.4.16-46.el7.x86_64 39 python2-cryptography-1.3.1-3.el7.x86_64 40 hyphen-en-2.8.6-5.el7.noarch 41 [root@web1 yum.repos.d]#
1 Installed: 2 zabbix-get.x86_64 0:4.0.4-1.el7 zabbix-server-mysql.x86_64 0:4.0.4-1.el7 zabbix-web-mysql.noarch 0:4.0.4-1.el7 3 4 Dependency Installed: 5 OpenIPMI-libs.x86_64 0:2.0.23-2.el7 OpenIPMI-modalias.x86_64 0:2.0.23-2.el7 fping.x86_64 0:3.10-4.el7 6 iksemel.x86_64 0:1.4-2.el7.centos zabbix-web.noarch 0:4.0.4-1.el7 7 8 Complete!
2.2、部署數據庫
52 上部署
yum install -y mariadb-embedded mariadb-libs mariadb-bench mariadb mariadb-server
1 Installed: 2 mariadb.x86_64 1:5.5.60-1.el7_5 mariadb-bench.x86_64 1:5.5.60-1.el7_5 mariadb-embedded.x86_64 1:5.5.60-1.el7_5 3 4 Dependency Installed: 5 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 6 perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 7 perl-GD.x86_64 0:2.49-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 8 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 9 10 Updated: 11 mariadb-libs.x86_64 1:5.5.60-1.el7_5 12 13 Complete! 14 [root@web2 yum.repos.d]# rpm -qa |grep mariadb 15 mariadb-libs-5.5.60-1.el7_5.x86_64 16 mariadb-embedded-5.5.60-1.el7_5.x86_64 17 mariadb-bench-5.5.60-1.el7_5.x86_64 18 mariadb-5.5.60-1.el7_5.x86_64 19 [root@web2 yum.repos.d]#
忘記安裝了mariadb-server,記得安裝啊
1 [root@web2 /]# rpm -qa |grep mariadb 2 mariadb-embedded-5.5.60-1.el7_5.x86_64 3 mariadb-5.5.60-1.el7_5.x86_64 4 mariadb-server-5.5.60-1.el7_5.x86_64 5 mariadb-bench-5.5.60-1.el7_5.x86_64 6 mariadb-libs-5.5.60-1.el7_5.x86_64
4、軟件配置
1)、配置nginx
cat /etc/nginx/conf.d/default.conf
1 [root@web1 yum.repos.d]# cat /etc/nginx/conf.d/default.conf 2 server { 3 listen 80; 4 server_name 192.168.216.51; 5 index index.html index.htm index.php; 6 charset utf-8; 7 root /usr/share/nginx/html; 8 9 location ~.*\.php$ { 10 fastcgi_pass unix:/dev/shm/php-fpm.sock; 11 fastcgi_index index.php; 12 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 13 include fastcgi_params; 14 try_files $uri = 404; 15 } 16 17 location ~.*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$ { 18 expires 30d; 19 } 20 location ~.*\.(js|css)$ { 21 expires 12h; 22 } 23 24 25 }
2)、配置php-fpm
cat /etc/php-fpm.d/www.conf
修改下面幾項
1 listen = /dev/shm/php-fpm.sock 2 listen.owner = nobody 3 listen.group = nobody 4 user = nginx 5 group = nginx
啟動nginx和php-fpm
1 [root@web1 yum.repos.d]# systemctl start nginx 2 [root@web1 yum.repos.d]# systemctl start php-fpm 3 [root@web1 yum.repos.d]# netstat -untlp |grep 80 4 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13408/nginx: master 5 tcp6 0 0 :::80 :::* LISTEN 13408/nginx: master 6 [root@web1 yum.repos.d]# netstat -untlp |grep php* 7 [root@web1 yum.repos.d]# ps -aux |grep php* 8 root 14058 0.0 0.7 417184 13444 ? Ss 00:04 0:00 php-fpm: master process (/etc/php-fpm.conf) 9 nginx 14060 0.0 0.3 419268 6468 ? S 00:04 0:00 php-fpm: pool www 10 nginx 14061 0.0 0.3 419268 6468 ? S 00:04 0:00 php-fpm: pool www 11 nginx 14062 0.0 0.3 419268 6468 ? S 00:04 0:00 php-fpm: pool www 12 nginx 14063 0.0 0.3 419268 6468 ? S 00:04 0:00 php-fpm: pool www 13 nginx 14064 0.0 0.3 419268 6468 ? S 00:04 0:00 php-fpm: pool www 14 root 14223 0.0 0.0 112652 968 pts/0 S+ 00:18 0:00 grep --color=auto php*
最后記得開機自啟
systemctl enable nginx
systemctl enable php-fpm
測試一下php,添加index.php,訪問一下192.168.216.51
1 [root@web1 html]# pwd 2 /usr/share/nginx/html 3 [root@web1 html]# cat index.php 4 <?php 5 phpinfo(); 6 ?> 7 8 [root@web1 html]#

沒問題,進入下一步驟
3)、配置數據庫
我們在52安裝的數據庫
3.1、啟動一下服務
1 Installed: 2 mariadb-server.x86_64 1:5.5.60-1.el7_5 3 4 Dependency Installed: 5 perl-DBD-MySQL.x86_64 0:4.023-6.el7 6 7 Complete! 8 [root@web2 yum.repos.d]# systemctl start mariadb 9 [root@web2 yum.repos.d]# netstat -untlp |grep 3306 10 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 5563/mysqld 11 [root@web2 yum.repos.d]# systemctl enable mariadb
3.2、創建zabbix database,zabbix賬戶,修改root密碼
1 [root@web2 yum.repos.d]# mysql #進入數據庫 2 Welcome to the MariaDB monitor. Commands end with ; or \g. 3 Your MariaDB connection id is 3 4 Server version: 5.5.60-MariaDB MariaDB Server 5 6 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 7 8 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 9 10 MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin; #創建database 11 Query OK, 1 row affected (0.00 sec) 12 13 14 15 MariaDB [(none)]> GRANT all privileges ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'admin123'; #建賬戶授權 16 Query OK, 0 rows affected (0.00 sec) 17 18 MariaDB [(none)]> flush privileges; #刷新 19 Query OK, 0 rows affected (0.00 sec) 20 21 MariaDB [(none)]> use mysql; 22 Reading table information for completion of table and column names 23 You can turn off this feature to get a quicker startup with -A 24 25 Database changed 26 MariaDB [mysql]> update user set password=password('admin123') where user='root'; #改root密碼 27 Query OK, 4 rows affected (0.00 sec) 28 Rows matched: 4 Changed: 4 Warnings: 0 29 30 MariaDB [mysql]> flush privileges; 31 Query OK, 0 rows affected (0.00 sec)
3.3、51上測試連接數據
1 [root@web1 html]# mv index.php index.php.phpinfo 2 [root@web1 html]# vim index.php 3 <?php 4 $link=mysql_connect('192.168.216.52','zabbix','admin123'); 5 if($link) echo "<h1>The database connection was successful!</h1>"; 6 else echo "<h1>The database connection was Fail!!</h1>"; 7 mysql_close(); 8 ?>

3.4、導入zabbix database 數據庫腳本
51上
1 [root@web1 html]# rpm -ql zabbix-server-mysql-4.0.4-1.el7.x86_64 2 /etc/logrotate.d/zabbix-server 3 /etc/zabbix/zabbix_server.conf 4 /usr/lib/systemd/system/zabbix-server.service 5 /usr/lib/tmpfiles.d/zabbix-server.conf 6 /usr/lib/zabbix/alertscripts 7 /usr/lib/zabbix/externalscripts 8 /usr/sbin/zabbix_server_mysql 9 /usr/share/doc/zabbix-server-mysql-4.0.4 10 /usr/share/doc/zabbix-server-mysql-4.0.4/AUTHORS 11 /usr/share/doc/zabbix-server-mysql-4.0.4/COPYING 12 /usr/share/doc/zabbix-server-mysql-4.0.4/ChangeLog 13 /usr/share/doc/zabbix-server-mysql-4.0.4/NEWS 14 /usr/share/doc/zabbix-server-mysql-4.0.4/README 15 /usr/share/doc/zabbix-server-mysql-4.0.4/create.sql.gz #就是要找這個數據庫腳本 16 /usr/share/man/man8/zabbix_server.8.gz 17 /var/log/zabbix 18 /var/run/zabbix
1 [root@web1 zabbix-server-mysql-4.0.4]# gunzip create.sql.gz #解壓縮 2 [root@web1 zabbix-server-mysql-4.0.4]# ll 3 total 6736 4 -rw-r--r-- 1 root root 98 Feb 4 17:57 AUTHORS 5 -rw-r--r-- 1 root root 940849 Feb 4 17:57 ChangeLog 6 -rw-r--r-- 1 root root 17990 Feb 4 17:57 COPYING 7 -rw-r--r-- 1 root root 5920915 Feb 4 18:02 create.sql 8 -rw-r--r-- 1 root root 52 Feb 4 17:57 NEWS 9 -rw-r--r-- 1 root root 1062 Feb 4 17:57 README 10 [root@web1 zabbix-server-mysql-4.0.4]# scp create.sql root@192.168.216.52:/ #發送到52上,數據庫服務器
52上,導入zabbix database腳本
1 [root@web2 /]# mysql -uroot zabbix < /create.sql -p 2 Enter password: 3 [root@web2 /]# mysql -uroot -p 4 Enter password: 5 Welcome to the MariaDB monitor. Commands end with ; or \g. 6 Your MariaDB connection id is 8 7 Server version: 5.5.60-MariaDB MariaDB Server 8 9 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 10 11 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 12 13 MariaDB [(none)]> use zabbix; 14 Reading table information for completion of table and column names 15 You can turn off this feature to get a quicker startup with -A 16 17 Database changed 18 MariaDB [zabbix]> show tables; 19 +----------------------------+ 20 | Tables_in_zabbix | 21 +----------------------------+ 22 | acknowledges | 23 | actions | 24 | alerts | 25 | application_discovery | 26 | application_prototype | 27 | application_template | 28 | applications | 29 | auditlog | 30 | auditlog_details | 31 | autoreg_host | 32 | conditions | 33 | config | 34 | corr_condition | 35 | corr_condition_group | 36 | corr_condition_tag | 37 | corr_condition_tagpair | 38 | corr_condition_tagvalue | 39 | corr_operation | 40 | correlation | 41 | dashboard | 42 | dashboard_user | 43 | dashboard_usrgrp | 44 | dbversion | 45 | dchecks | 46 | dhosts | 47 | drules | 48 | dservices | 49 | escalations | 50 | event_recovery | 51 | event_suppress | 52 | event_tag | 53 | events | 54 | expressions | 55 | functions | 56 | globalmacro | 57 | globalvars | 58 | graph_discovery | 59 | graph_theme | 60 | graphs | 61 | graphs_items | 62 | group_discovery | 63 | group_prototype | 64 | history | 65 | history_log | 66 | history_str | 67 | history_text | 68 | history_uint | 69 | host_discovery | 70 | host_inventory | 71 | hostmacro | 72 | hosts | 73 | hosts_groups | 74 | hosts_templates | 75 | housekeeper | 76 | hstgrp | 77 | httpstep | 78 | httpstep_field | 79 | httpstepitem | 80 | httptest | 81 | httptest_field | 82 | httptestitem | 83 | icon_map | 84 | icon_mapping | 85 | ids | 86 | images | 87 | interface | 88 | interface_discovery | 89 | item_application_prototype | 90 | item_condition | 91 | item_discovery | 92 | item_preproc | 93 | items | 94 | items_applications | 95 | maintenance_tag | 96 | maintenances | 97 | maintenances_groups | 98 | maintenances_hosts | 99 | maintenances_windows | 100 | mappings | 101 | media | 102 | media_type | 103 | opcommand | 104 | opcommand_grp | 105 | opcommand_hst | 106 | opconditions | 107 | operations | 108 | opgroup | 109 | opinventory | 110 | opmessage | 111 | opmessage_grp | 112 | opmessage_usr | 113 | optemplate | 114 | problem | 115 | problem_tag | 116 | profiles | 117 | proxy_autoreg_host | 118 | proxy_dhistory | 119 | proxy_history | 120 | regexps | 121 | rights | 122 | screen_user | 123 | screen_usrgrp | 124 | screens | 125 | screens_items | 126 | scripts | 127 | service_alarms | 128 | services | 129 | services_links | 130 | services_times | 131 | sessions | 132 | slides | 133 | slideshow_user | 134 | slideshow_usrgrp | 135 | slideshows | 136 | sysmap_element_trigger | 137 | sysmap_element_url | 138 | sysmap_shape | 139 | sysmap_url | 140 | sysmap_user | 141 | sysmap_usrgrp | 142 | sysmaps | 143 | sysmaps_elements | 144 | sysmaps_link_triggers | 145 | sysmaps_links | 146 | tag_filter | 147 | task | 148 | task_acknowledge | 149 | task_check_now | 150 | task_close_problem | 151 | task_remote_command | 152 | task_remote_command_result | 153 | timeperiods | 154 | trends | 155 | trends_uint | 156 | trigger_depends | 157 | trigger_discovery | 158 | trigger_tag | 159 | triggers | 160 | users | 161 | users_groups | 162 | usrgrp | 163 | valuemaps | 164 | widget | 165 | widget_field | 166 +----------------------------+ 167 144 rows in set (0.00 sec)
ok已經成功導入
4)、修改zabbix配置文件,設置權限
vim /etc/zabbix/zabbix_server.conf
ListenPort=10051
DBHost=192.168.216.52
DBName=zabbix
DBUser=zabbix
DBPassword=admin123
DBPort=3306
修改這幾項應該就可以了
1 [root@web1 zabbix-server-mysql-4.0.4]# systemctl restart zabbix-server 2 [root@web1 zabbix-server-mysql-4.0.4]# !net 3 bash: !net: command not found... 4 [root@web1 zabbix-server-mysql-4.0.4]# !net 5 netstat -untlpo 6 Active Internet connections (only servers) 7 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name Timer 8 tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd off (0.00/0/0) 9 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 15347/nginx: master off (0.00/0/0) 10 tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2192/dnsmasq off (0.00/0/0) 11 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 884/sshd off (0.00/0/0) 12 tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 882/cupsd off (0.00/0/0) 13 tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2010/master off (0.00/0/0) 14 tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 15505/zabbix_server off (0.00/0/0) 15 tcp6 0 0 :::111 :::* LISTEN 1/systemd off (0.00/0/0) 16 tcp6 0 0 :::80 :::* LISTEN 15347/nginx: master off (0.00/0/0) 17 tcp6 0 0 :::22 :::* LISTEN 884/sshd off (0.00/0/0) 18 tcp6 0 0 ::1:631 :::* LISTEN 882/cupsd off (0.00/0/0) 19 tcp6 0 0 ::1:25 :::* LISTEN 2010/master off (0.00/0/0) 20 tcp6 0 0 :::10051 :::* LISTEN 15505/zabbix_server off (0.00/0/0) 21 udp 0 0 0.0.0.0:5353 0.0.0.0:* 592/avahi-daemon: r off (0.00/0/0) 22 udp 0 0 0.0.0.0:58177 0.0.0.0:* 592/avahi-daemon: r off (0.00/0/0) 23 udp 0 0 192.168.122.1:53 0.0.0.0:* 2192/dnsmasq off (0.00/0/0) 24 udp 0 0 0.0.0.0:67 0.0.0.0:* 2192/dnsmasq off (0.00/0/0) 25 udp 0 0 0.0.0.0:177 0.0.0.0:* 897/lightdm off (0.00/0/0) 26 udp6 0 0 :::177 :::* 897/lightdm off (0.00/0/0) 27 [root@web1 zabbix-server-mysql-4.0.4]#
最后修改nginx配置文件
51上
cat /etc/nginx/conf.d/default.conf
修改下面一項即可
root /usr/share/zabbix;
systemctl restart nginx
問題1、訪問192.168.216.51 出錯代碼500
cat /var/log/nginx/error.log
tail -5 /var/log/nginx/error.log
1 PHP Fatal error: require_once(): Failed opening required '/etc/zabbix/web/maintenance.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /usr/share/zabbix/include/classes/core/ZBase.php on line 276" while reading response header from upstream, client: 192.168.216.1, server: 192.168.216.51, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/dev/shm/php-fpm.sock:", host: "192.168.216.51"
修改權限
1 505 chown -R zabbix:zabbix /etc/zabbix 2 506 chown -R zabbix:zabbix /usr/share/zabbix 3 507 chown -R zabbix:zabbix /usr/lib/zabbix 4 508 chmod -R 755 /etc/zabbix/web
訪問192.168.216.51

三、正式開始web界面配置安裝配置zabbix
1、第一步welcome 點擊下一步網頁還是跳會第一步
問題2、無法進行第2步
有可能是php session沒起作用
修改php session 權限
chmod -R 777 /var/lib/php/session/
2、第二步 check of pre-requisites
檢查先決條件

問題3、先把fail解決,修改php文件
vim /etc/php.ini
1 post_max_size = 32M 2 3 max_execution_time = 300 4 5 max_input_time = 300 6 7 date.timezone = PRC
systemctl restart php-fpm
訪問一下,好了,進行下一步,點擊next step

3、configure DB connection
配置連接的數據庫

問題4、點擊nextstep 出錯,上一篇也遇到了這個問題

查看nginx日志發現
1 [root@web1 share]# !tail 2 tail -5 /var/log/nginx/error.log 3 2019/02/25 14:28:31 [error] 98806#0: *1 upstream sent too big header while reading response header from upstream, client: 192.168.216.1, server: 192.168.216.51, request: "GET /setup.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.216.51" 4 2019/02/25 14:28:31 [error] 98806#0: *1 upstream sent too big header while reading response header from upstream, client: 192.168.216.1, server: 192.168.216.51, request: "GET /setup.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.216.51" 5 2019/02/25 14:28:32 [error] 98806#0: *1 upstream sent too big header while reading response header from upstream, client: 192.168.216.1, server: 192.168.216.51, request: "GET /setup.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.216.51" 6 2019/02/25 14:28:32 [error] 98806#0: *1 upstream sent too big header while reading response header from upstream, client: 192.168.216.1, server: 192.168.216.51, request: "GET /setup.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.216.51" 7 2019/02/25 14:30:14 [error] 98804#0: *10 upstream sent too big header while reading response header from upstream, client: 192.168.216.1, server: 192.168.216.51, request: "GET /setup.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.216.51" 8 [root@web1 share]# vim /etc/nginx/conf.d/default.conf
upstream sent too big header while reading response header from upstream
是這個問題導致,在網站找好多方法,都不行,最后看到是因為fastcgi緩沖區設置過小,其實是header過大
添加緩存區解決,編輯nginx 配置文件,添加兩項
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
1 [root@web1 share]# vim /etc/nginx/conf.d/default.conf 2 3 4 server { 5 listen 80; 6 server_name 192.168.216.51; 7 index index.html index.htm index.php; 8 charset utf-8; 9 root /usr/share/zabbix; 10 location / { 11 #max_fails=6; 12 #fail_timeout=60; 13 root /usr/share/zabbix; 14 } 15 16 location ~.*\.php$ { 17 fastcgi_connect_timeout 300; 18 root /usr/share/zabbix; 19 fastcgi_send_timeout 300; 20 fastcgi_read_timeout 300; 21 fastcgi_buffers 8 16k; 22 fastcgi_buffer_size 32k; 23 #fastcgi_pass unix:/dev/shm/php-fpm.sock; 24 fastcgi_pass 127.0.0.1:9000; 25 fastcgi_index index.php; 26 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 27 include fastcgi_params; 28 try_files $uri = 404; 29 } 30 31 location ~.*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$ { 32 expires 30d; 33 } 34 location ~.*\.(js|css)$ { 35 expires 12h; 36 } 37 38 39 }
4、zabbix server details
這個也可以默認配置,因為進入zabbix主頁后是可以修改的
5、pre-installation summary
就是安裝配置的一個總結,檢查看看有沒有出錯

6、INSTALL
最后就是報錯配置了
問題5、Unable to create the configuration file.
這里沒來得及截圖提示Unable to create the configuration file.
/etc/zabbix/web沒有權限導致,我選擇第一項下載zabbix.conf.php 然后上傳到相應目錄,在點一下,就是如下頁面了

奇怪的是我點擊login 然后用默認admin 密碼zabbix 無法登陸

其實zabbix 默認賬戶為Admin 密碼zabbix,zabbix 的簡單部署就到這里了,新的zabbix 監控頁面如下:

轉載請注明出處:https://www.cnblogs.com/zhangxingeng/p/10414070.html
