1. 程式人生 > >Linux監控平臺搭建(一)

Linux監控平臺搭建(一)

Name Version
Centos 7 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
zabbix zabbix-3.4.2
mysql mysql-5.6.35
httpd httpd-2.4.33
php php-7.1.6

Linux監控平臺介紹

常見開源監控軟體

  • cacti、nagios、zabbix、smokeping、open-falcon等等

  • cacti、smokeping偏向於基礎監控,成圖非常漂亮

  • cacti、nagios、zabbix服務端監控中心,需要php環境支援,其中zabbix和cacti都需要mysql作為資料儲存,nagios不用儲存歷史資料,注重服務或者監控項的狀態,zabbix會獲取服務或者監控專案的資料,會把資料記錄到資料庫裡,從而可以成圖

  • open-falcon為小米公司開發,開源後受到諸多大公司和運維工程師的追捧,適合大企業,滴滴、360、新浪微博、京東等大公司在使用這款監控軟體,值得研究

  • 後續以介紹zabbix為主

zabbix監控介紹

  • C/S架構,基於C++開發,監控中心支援web介面配置和管理

  • 單server節點可以支援上萬臺客戶端

  • 5個元件

  • zabbix-server 監控中心,接收客戶端上報資訊,負責配置、統計、操作資料

  • 資料儲存 存放資料,比如mysql

  • web介面 也叫web UI,在web介面下操作配置是zabbix簡單易用的主要原因

  • zabbix-proxy 可選元件,它可以代替zabbix-server的功能,減輕server的壓力

  • zabbix-agent 客戶端軟體,負責採集各個監控服務或專案的資料,並上報

yum安裝出現問題(未知原因,估計是網站有時段限制,拒接連線導致)

原始碼安裝zabbix

zabbix系統基於PHP環境執行,所以前提是系統上有PHP的執行環境,lnmp或者lamp環境。

1、下載原始碼包

  [root@zyshanlinux-001 src]# wget -O zabbix-3.4.2.tar.gz http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.2/zabbix-3.4.2.tar.gz/download

2、安裝依賴庫

  [root@zyshanlinux-001 src]# yum -y install net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel

3、解壓包

  [root@zyshanlinux-001 src]# ls
  zabbix-3.4.2.tar.gz
  ​
  [root@zyshanlinux-001 src]# tar -zxf zabbix-3.4.2.tar.gz
  [root@zyshanlinux-001 src]# ls
  zabbix-3.4.2                             zabbix-3.4.2.tar.gz
   

4、編譯

  [root@zyshanlinux-001 src]# cd zabbix-3.4.2
  [root@zyshanlinux-001 zabbix-3.4.2]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
  ...
  config.status: creating src/zabbix_java/Makefile
  config.status: creating upgrades/Makefile
  config.status: creating man/Makefile
  config.status: creating include/config.h
  config.status: executing depfiles commands
  ​
  ​
  Configuration:
  ​
    Detected OS:           linux-gnu
    Install path:          /usr/local/zabbix
    Compilation arch:      linux
  ​
    Compiler:              gcc
    Compiler flags:         -g -O2 
  ​
    Library-specific flags:
      database:               -I/usr/local/mysql/include  -fPIC  -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing   
      libXML2:               -I/usr/include/libxml2
      Net-SNMP:               -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include
  ​
    Enable server:         yes
    Server details:
      With database:         MySQL
      WEB Monitoring:        cURL
      Native Jabber:         no
      SNMP:                  yes
      IPMI:                  no
      SSH:                   no
      TLS:                   no
      ODBC:                  no
      Linker flags:             -L/usr/local/mysql/lib        -L/usr/lib64       -rdynamic   
      Libraries:               -lmysqlclient      -lxml2    -lnetsnmp   -levent    -lcurl -lm -ldl  -lresolv -lpcreposix -lpcre 
  ​
    Enable proxy:          no
  ​
    Enable agent:          yes
    Agent details:
      TLS:                   no
      Linker flags:              -rdynamic   
      Libraries:                 -lcurl -lm -ldl  -lresolv -lpcreposix -lpcre 
  ​
    Enable Java gateway:   no
  ​
    LDAP support:          no
    IPv6 support:          yes
  ​
  ***********************************************************
  *            Now run 'make install'                       *
  *                                                         *
  *            Thank you for using Zabbix!                  *
  *              <http://www.zabbix.com>                    *
  ***********************************************************
  ​

5、安裝

  [root@zyshanlinux-001 zabbix-3.4.2]# make && make install

6、解除安裝

隔天yum恢復正常(未知原因,估計是網站有時段限制,拒接連線導致),把原始碼安裝解除安裝,在make install目錄下

  [root@zyshanlinux-001 zabbix-3.4.2]# make uninstall

yum安裝zabbix

  [root@zyshanlinux-001 src]# wget https://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

安裝該rpm包

  [root@zyshanlinux-001 src]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm
  警告:zabbix-release-3.2-1.el7.noarch.rpm: 頭V4 RSA/SHA512 Signature, 金鑰 ID a14fe591: NOKEY
  準備中...                          ################################# [100%]
  正在升級/安裝...
     1:zabbix-release-3.2-1.el7         ################################# [100%]

安裝了zabbix的rpm包後,其實就是多了一個yum源,多了一個zabbix.repo檔案

  [root@zyshanlinux-001 yum.repos.d]# ls
  CentOS7-Base-163.repo  CentOS-Media.repo    epel-testing.repo  remi-glpi93.repo  remi-php72.repo  zabbix.repo
  CentOS-CR.repo         CentOS-Sources.repo  nux-dextop.repo    remi-php54.repo   remi-php73.repo
  CentOS-Debuginfo.repo  CentOS-Vault.repo    remi-glpi91.repo   remi-php70.repo   remi.repo
  CentOS-fasttrack.repo  epel.repo            remi-glpi92.repo   remi-php71.repo   remi-safe.repo

檔案zabbix.repo的內容

  [root@zyshanlinux-001 yum.repos.d]# cat /etc/yum.repos.d/zabbix.repo 
  [zabbix]
  name=Zabbix Official Repository - $basearch
  baseurl=http://repo.zabbix.com/zabbix/3.2/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/
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
  gpgcheck=1

在zabbix源中需要安裝的包

zabbix-agent #客戶端軟體zabbix-get #服務端的工具,可以以命令列的形式獲取客戶端採集的資料zabbix-server-mysql #與mysql相關的檔案zabbix-web #web UIzabbix-web-mysql #web與mysql相關的檔案

安裝上面的包

  [root@zyshanlinux-001 ~]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
  已載入外掛:fastestmirror
  base                                                                                     | 3.6 kB  00:00:00     
  epel/x86_64/metalink                                                                     | 7.5 kB  00:00:00     
  extras                                                                                   | 3.4 kB  00:00:00     
  updates                                                                                  | 3.4 kB  00:00:00     
  zabbix                                                                                   | 2.9 kB  00:00:00     
  zabbix-non-supported                                                                     |  951 B  00:00:00     
  (1/2): zabbix/x86_64/primary_db                                                          |  93 kB  00:00:01     
  (2/2): updates/7/x86_64/primary_db                                                       | 4.3 MB  00:00:12     
  zabbix-non-supported/x86_64/primary                                                      | 1.6 kB  00:00:00     
  Loading mirror speeds from cached hostfile
   * base: mirrors.163.com
   * epel: mirrors.tongji.edu.cn
   * extras: mirrors.163.com
   * updates: linux.cs.nctu.edu.tw
  zabbix-non-supported                                                                                        4/4
  正在解決依賴關係
  --> 正在檢查事務
  ---> 軟體包 zabbix-agent.x86_64.0.3.4.11-1.el7 將被 安裝
  ---> 軟體包 zabbix-get.x86_64.0.3.4.11-1.el7 將被 安裝
  ---> 軟體包 zabbix-server-mysql.x86_64.0.3.4.11-1.el7 將被 安裝
  --> 正在處理依賴關係 fping,它被軟體包 zabbix-server-mysql-3.4.11-1.el7.x86_64 需要
  --> 正在處理依賴關係 libiksemel.so.3()(64bit),它被軟體包 zabbix-server-mysql-3.4.11-1.el7.x86_64 需要
  --> 正在處理依賴關係 libOpenIPMIposix.so.0()(64bit),它被軟體包 zabbix-server-mysql-3.4.11-1.el7.x86_64 需要
  --> 正在處理依賴關係 libOpenIPMI.so.0()(64bit),它被軟體包 zabbix-server-mysql-3.4.11-1.el7.x86_64 需要
  --> 正在處理依賴關係 libodbc.so.2()(64bit),它被軟體包 zabbix-server-mysql-3.4.11-1.el7.x86_64 需要
  ---> 軟體包 zabbix-web.noarch.0.3.4.11-1.el7 將被 安裝
  --> 正在處理依賴關係 php >= 5.4,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 httpd,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 php-gd,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 php-mbstring,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 dejavu-sans-fonts,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 php-bcmath,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 php-ldap,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  --> 正在處理依賴關係 php-xml,它被軟體包 zabbix-web-3.4.11-1.el7.noarch 需要
  ---> 軟體包 zabbix-web-mysql.noarch.0.3.4.11-1.el7 將被 安裝
  --> 正在處理依賴關係 php-mysql,它被軟體包 zabbix-web-mysql-3.4.11-1.el7.noarch 需要
  --> 正在檢查事務
  ---> 軟體包 OpenIPMI-libs.x86_64.0.2.0.23-2.el7 將被 安裝
  --> 正在處理依賴關係 OpenIPMI-modalias = 2.0.23-2.el7,它被軟體包 OpenIPMI-libs-2.0.23-2.el7.x86_64 需要
  ---> 軟體包 dejavu-sans-fonts.noarch.0.2.33-6.el7 將被 安裝
  --> 正在處理依賴關係 dejavu-fonts-common = 2.33-6.el7,它被軟體包 dejavu-sans-fonts-2.33-6.el7.noarch 需要
  ---> 軟體包 fping.x86_64.0.3.10-4.el7 將被 安裝
  ---> 軟體包 httpd.x86_64.0.2.4.6-80.el7.centos.1 將被 安裝
  --> 正在處理依賴關係 httpd-tools = 2.4.6-80.el7.centos.1,它被軟體包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
  --> 正在處理依賴關係 /etc/mime.types,它被軟體包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
  --> 正在處理依賴關係 libaprutil-1.so.0()(64bit),它被軟體包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
  --> 正在處理依賴關係 libapr-1.so.0()(64bit),它被軟體包 httpd-2.4.6-80.el7.centos.1.x86_64 需要
  ---> 軟體包 iksemel.x86_64.0.1.4-2.el7.centos 將被 安裝
  --> 正在處理依賴關係 libgnutls.so.28(GNUTLS_1_4)(64bit),它被軟體包 iksemel-1.4-2.el7.centos.x86_64 需要
  --> 正在處理依賴關係 libgnutls.so.28()(64bit),它被軟體包 iksemel-1.4-2.el7.centos.x86_64 需要
  ---> 軟體包 php.x86_64.0.5.4.16-45.el7 將被 安裝
  --> 正在處理依賴關係 php-common(x86-64) = 5.4.16-45.el7,它被軟體包 php-5.4.16-45.el7.x86_64 需要
  --> 正在處理依賴關係 php-cli(x86-64) = 5.4.16-45.el7,它被軟體包 php-5.4.16-45.el7.x86_64 需要
  ---> 軟體包 php-bcmath.x86_64.0.5.4.16-45.el7 將被 安裝
  ---> 軟體包 php-gd.x86_64.0.5.4.16-45.el7 將被 安裝
  --> 正在處理依賴關係 libt1.so.5()(64bit),它被軟體包 php-gd-5.4.16-45.el7.x86_64 需要
  ---> 軟體包 php-ldap.x86_64.0.5.4.16-45.el7 將被 安裝
  ---> 軟體包 php-mbstring.x86_64.0.5.4.16-45.el7 將被 安裝
  ---> 軟體包 php-mysql.x86_64.0.5.4.16-45.el7 將被 安裝
  --> 正在處理依賴關係 php-pdo(x86-64) = 5.4.16-45.el7,它被軟體包 php-mysql-5.4.16-45.el7.x86_64 需要
  ---> 軟體包 php-xml.x86_64.0.5.4.16-45.el7 將被 安裝
  ---> 軟體包 unixODBC.x86_64.0.2.3.1-11.el7 將被 安裝
  --> 正在檢查事務
  ---> 軟體包 OpenIPMI-modalias.x86_64.0.2.0.23-2.el7 將被 安裝
  ---> 軟體包 apr.x86_64.0.1.4.8-3.el7_4.1 將被 安裝
  ---> 軟體包 apr-util.x86_64.0.1.5.2-6.el7 將被 安裝
  ---> 軟體包 dejavu-fonts-common.noarch.0.2.33-6.el7 將被 安裝
  ---> 軟體包 gnutls.x86_64.0.3.3.26-9.el7 將被 安裝
  --> 正在處理依賴關係 trousers >= 0.3.11.2,它被軟體包 gnutls-3.3.26-9.el7.x86_64 需要
  --> 正在處理依賴關係 libnettle.so.4()(64bit),它被軟體包 gnutls-3.3.26-9.el7.x86_64 需要
  --> 正在處理依賴關係 libhogweed.so.2()(64bit),它被軟體包 gnutls-3.3.26-9.el7.x86_64 需要
  ---> 軟體包 httpd-tools.x86_64.0.2.4.6-80.el7.centos.1 將被 安裝
  ---> 軟體包 mailcap.noarch.0.2.1.41-2.el7 將被 安裝
  ---> 軟體包 php-cli.x86_64.0.5.4.16-45.el7 將被 安裝
  ---> 軟體包 php-common.x86_64.0.5.4.16-45.el7 將被 安裝
  --> 正在處理依賴關係 libzip.so.2()(64bit),它被軟體包 php-common-5.4.16-45.el7.x86_64 需要
  ---> 軟體包 php-pdo.x86_64.0.5.4.16-45.el7 將被 安裝
  ---> 軟體包 t1lib.x86_64.0.5.1.2-14.el7 將被 安裝
  --> 正在檢查事務
  ---> 軟體包 libzip.x86_64.0.0.10.1-8.el7 將被 安裝
  ---> 軟體包 nettle.x86_64.0.2.7.1-8.el7 將被 安裝
  ---> 軟體包 trousers.x86_64.0.0.3.14-2.el7 將被 安裝
  --> 解決依賴關係完成
  ​
  依賴關係解決
  ​
  ================================================================================================================
   Package                     架構           版本                             源                            大小
  ================================================================================================================
  正在安裝:
   zabbix-agent                x86_64         3.4.11-1.el7                     zabbix                       365 k
   zabbix-get                  x86_64         3.4.11-1.el7                     zabbix                       253 k
   zabbix-server-mysql         x86_64         3.4.11-1.el7                     zabbix                       2.0 M
   zabbix-web                  noarch         3.4.11-1.el7                     zabbix                       2.7 M
   zabbix-web-mysql            noarch         3.4.11-1.el7                     zabbix                       6.9 k
  為依賴而安裝:
   OpenIPMI-libs               x86_64         2.0.23-2.el7                     base                         521 k
   OpenIPMI-modalias           x86_64         2.0.23-2.el7                     base                          16 k
   apr                         x86_64         1.4.8-3.el7_4.1                  base                         103 k
   apr-util                    x86_64         1.5.2-6.el7                      base                          92 k
   dejavu-fonts-common         noarch         2.33-6.el7                       base                          64 k
   dejavu-sans-fonts           noarch         2.33-6.el7                       base                         1.4 M
   fping                       x86_64         3.10-4.el7                       epel                          46 k
   gnutls                      x86_64         3.3.26-9.el7                     base                         677 k
   httpd                       x86_64         2.4.6-80.el7.centos.1            updates                      2.7 M
   httpd-tools                 x86_64         2.4.6-80.el7.centos.1            updates                       90 k
   iksemel                     x86_64         1.4-2.el7.centos                 zabbix-non-supported          49 k
   libzip                      x86_64         0.10.1-8.el7                     base                          48 k
   mailcap                     noarch         2.1.41-2.el7                     base                          31 k
   nettle                      x86_64         2.7.1-8.el7                      base                         327 k
   php                         x86_64         5.4.16-45.el7                    base                         1.4 M
   php-bcmath                  x86_64         5.4.16-45.el7                    base                          58 k
   php-cli                     x86_64         5.4.16-45.el7                    base                         2.7 M
   php-common                  x86_64         5.4.16-45.el7                    base                         565 k
   php-gd                      x86_64         5.4.16-45.el7                    base                         128 k
   php-ldap                    x86_64         5.4.16-45.el7                    base                          53 k
   php-mbstring                x86_64         5.4.16-45.el7                    base                         505 k
   php-mysql                   x86_64         5.4.16-45.el7                    base                         101 k
   php-pdo                     x86_64         5.4.16-45.el7                    base                          99 k
   php-xml                     x86_64         5.4.16-45.el7                    base                         126 k
   t1lib                       x86_64         5.1.2-14.el7                     base                         166 k
   trousers                    x86_64         0.3.14-2.el7                     base                         289 k
   unixODBC                    x86_64         2.3.1-11.el7                     base                         413 k
  ​
  事務概要
  ================================================================================================================
  安裝  5 軟體包 (+27 依賴軟體包)
  ​
  總下載量:18 M
  安裝大小:64 M
  Downloading packages:
  (1/32): OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm                                        |  16 kB  00:00:00     
  (2/32): dejavu-fonts-common-2.33-6.el7.noarch.rpm                                        |  64 kB  00:00:00     
  (3/32): apr-util-1.5.2-6.el7.x86_64.rpm                                                  |  92 kB  00:00:00     
  (4/32): apr-1.4.8-3.el7_4.1.x86_64.rpm                                                   | 103 kB  00:00:01     
  (5/32): fping-3.10-4.el7.x86_64.rpm                                                      |  46 kB  00:00:03     
  (6/32): OpenIPMI-libs-2.0.23-2.el7.x86_64.rpm                                            | 521 kB  00:00:05     
  (7/32): httpd-tools-2.4.6-80.el7.centos.1.x86_64.rpm                                     |  90 kB  00:00:01     
  (8/32): libzip-0.10.1-8.el7.x86_64.rpm                                                   |  48 kB  00:00:00     
  (9/32): gnutls-3.3.26-9.el7.x86_64.rpm                                                   | 677 kB  00:00:05     
  (10/32): mailcap-2.1.41-2.el7.noarch.rpm                                                 |  31 kB  00:00:00     
  (11/32): nettle-2.7.1-8.el7.x86_64.rpm                                                   | 327 kB  00:00:03     
  warning: /var/cache/yum/x86_64/7/zabbix-non-supported/packages/iksemel-1.4-2.el7.centos.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
  iksemel-1.4-2.el7.centos.x86_64.rpm 的公鑰尚未安裝
  (12/32): iksemel-1.4-2.el7.centos.x86_64.rpm                                             |  49 kB  00:00:05     
  (13/32): dejavu-sans-fonts-2.33-6.el7.noarch.rpm                                         | 1.4 MB  00:00:16     
  (14/32): php-cli-5.4.16-45.el7.x86_64.rpm                                                | 2.7 MB  00:00:14     
  (15/32): php-bcmath-5.4.16-45.el7.x86_64.rpm                                             |  58 kB  00:00:14     
  (16/32): php-gd-5.4.16-45.el7.x86_64.rpm                                                 | 128 kB  00:00:00     
  (17/32): php-ldap-5.4.16-45.el7.x86_64.rpm                                               |  53 kB  00:00:00     
  (18/32): php-common-5.4.16-45.el7.x86_64.rpm                                             | 565 kB  00:00:09     
  (19/32): php-pdo-5.4.16-45.el7.x86_64.rpm                                                |  99 kB  00:00:00     
  (20/32): php-mysql-5.4.16-45.el7.x86_64.rpm                                              | 101 kB  00:00:02     
  (21/32): php-mbstring-5.4.16-45.el7.x86_64.rpm                                           | 505 kB  00:00:02     
  (22/32): php-xml-5.4.16-45.el7.x86_64.rpm                                                | 126 kB  00:00:01     
  (23/32): t1lib-5.1.2-14.el7.x86_64.rpm                                                   | 166 kB  00:00:01     
  (24/32): trousers-0.3.14-2.el7.x86_64.rpm                                                | 289 kB  00:00:02     
  (25/32): unixODBC-2.3.1-11.el7.x86_64.rpm                                                | 413 kB  00:00:03     
  (26/32): php-5.4.16-45.el7.x86_64.rpm                                                    | 1.4 MB  00:00:25     
  warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-get-3.4.11-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
  zabbix-get-3.4.11-1.el7.x86_64.rpm 的公鑰尚未安裝
  (27/32): zabbix-get-3.4.11-1.el7.x86_64.rpm                                              | 253 kB  00:00:06     
  (28/32): httpd-2.4.6-80.el7.centos.1.x86_64.rpm                                          | 2.7 MB  00:00:37     
  (29/32): zabbix-agent-3.4.11-1.el7.x86_64.rpm                                            | 365 kB  00:00:12     
  (30/32): zabbix-server-mysql-3.4.11-1.el7.x86_64.rpm                                     | 2.0 MB  00:01:35     
  (31/32): zabbix-web-mysql-3.4.11-1.el7.noarch.rpm                                        | 6.9 kB  00:00:00     
  (32/32): zabbix-web-3.4.11-1.el7.noarch.rpm                                              | 2.7 MB  00:02:33     
  ----------------------------------------------------------------------------------------------------------------
  總計                                                                             94 kB/s |  18 MB  00:03:15     
  從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 檢索金鑰
  匯入 GPG key 0xA14FE591:
   使用者ID     : "Zabbix LLC <[email protected]>"
   指紋       : a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
   軟體包     : zabbix-release-3.4-2.el7.noarch (installed)
   來自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
  從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX 檢索金鑰
  匯入 GPG key 0x79EA5ED4:
   使用者ID     : "Zabbix SIA <[email protected]>"
   指紋       : fbab d5fb 2025 5eca b22e e194 d13d 58e4 79ea 5ed4
   軟體包     : zabbix-release-3.4-2.el7.noarch (installed)
   來自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
  Running transaction check
  Running transaction test
  Transaction test succeeded
  Running transaction
  警告:RPM 資料庫已被非 yum 程式修改。
    正在安裝    : apr-1.4.8-3.el7_4.1.x86_64                                                                 1/32 
    正在安裝    : apr-util-1.5.2-6.el7.x86_64                                                                2/32 
    正在安裝    : httpd-tools-2.4.6-80.el7.centos.1.x86_64                                                   3/32 
    正在安裝    : libzip-0.10.1-8.el7.x86_64                                                                 4/32 
    正在安裝    : php-common-5.4.16-45.el7.x86_64                                                            5/32 
    正在安裝    : php-bcmath-5.4.16-45.el7.x86_64                                                            6/32 
    正在安裝    : php-pdo-5.4.16-45.el7.x86_64                                                               7/32 
    正在安裝    : php-mysql-5.4.16-45.el7.x86_64                                                             8/32 
    正在安裝    : php-cli-5.4.16-45.el7.x86_64                                                               9/32 
    正在安裝    : php-ldap-5.4.16-45.el7.x86_64                                                             10/32 
    正在安裝    : php-xml-5.4.16-45.el7.x86_64                                                              11/32 
    正在安裝    : php-mbstring-5.4.16-45.el7.x86_64                                                         12/32 
    正在安裝    : unixODBC-2.3.1-11.el7.x86_64                                                              13/32 
    正在安裝    : t1lib-5.1.2-14.el7.x86_64                                                                 14/32 
    正在安裝    : php-gd-5.4.16-45.el7.x86_64                                                               15/32 
    正在安裝    : dejavu-fonts-common-2.33-6.el7.noarch                                                     16/32 
    正在安裝    : dejavu-sans-fonts-2.33-6.el7.noarch                                                       17/32 
    正在安裝    : OpenIPMI-modalias-2.0.23-2.el7.x86_64                                                     18/32 
    正在安裝    : OpenIPMI-libs-2.0.23-2.el7.x86_64                                                         19/32 
    正在安裝    : fping-3.10-4.el7.x86_64                                                                   20/32 
    正在安裝    : nettle-2.7.1-8.el7.x86_64                                                                 21/32 
    正在安裝    : mailcap-2.1.41-2.el7.noarch                                                               22/32 
    正在安裝    : httpd-2.4.6-80.el7.centos.1.x86_64                                                        23/32 
    正在安裝    : php-5.4.16-45.el7.x86_64                                                                  24/32 
    正在安裝    : zabbix-web-mysql-3.4.11-1.el7.noarch                                                      25/32 
    正在安裝    : zabbix-web-3.4.11-1.el7.noarch                                                            26/32 
    正在安裝    : trousers-0.3.14-2.el7.x86_64                                                              27/32 
    正在安裝    : gnutls-3.3.26-9.el7.x86_64                                                                28/32 
    正在安裝    : iksemel-1.4-2.el7.centos.x86_64                                                           29/32 
    正在安裝    : zabbix-server-mysql-3.4.11-1.el7.x86_64                                                   30/32 
    正在安裝    : zabbix-get-3.4.11-1.el7.x86_64                                                            31/32 
    正在安裝    : zabbix-agent-3.4.11-1.el7.x86_64                                                          32/32 
  sed:無法讀取 /etc/sysconfig/ipmi:沒有那個檔案或目錄
    驗證中      : trousers-0.3.14-2.el7.x86_64                                                               1/32 
    驗證中      : mailcap-2.1.41-2.el7.noarch                                                                2/32 
    驗證中      : httpd-tools-2.4.6-80.el7.centos.1.x86_64                                                   3/32 
    驗證中      : httpd-2.4.6-80.el7.centos.1.x86_64                                                         4/32 
    驗證中      : zabbix-web-3.4.11-1.el7.noarch                                                             5/32 
    驗證中      : php-bcmath-5.4.16-45.el7.x86_64                                                            6/32 
    驗證中      : nettle-2.7.1-8.el7.x86_64                                                                  7/32 
    驗證中      : fping-3.10-4.el7.x86_64                                                                    8/32 
    驗證中      : OpenIPMI-modalias-2.0.23-2.el7.x86_64                                                      9/32 
    驗證中      : php-pdo-5.4.16-45.el7.x86_64                                                              10/32 
    驗證中      : OpenIPMI-libs-2.0.23-2.el7.x86_64                                                         11/32 
    驗證中      : php-5.4.16-45.el7.x86_64                                                                  12/32 
    驗證中      : php-cli-5.4.16-45.el7.x86_64                                                              13/32 
    驗證中      : dejavu-fonts-common-2.33-6.el7.noarch                                                     14/32 
    驗證中      : t1lib-5.1.2-14.el7.x86_64                                                                 15/32 
    驗證中      : zabbix-server-mysql-3.4.11-1.el7.x86_64                                                   16/32 
    驗證中      : gnutls-3.3.26-9.el7.x86_64                                                                17/32 
    驗證中      : php-ldap-5.4.16-45.el7.x86_64                                                             18/32 
    驗證中      : php-xml-5.4.16-45.el7.x86_64                                                              19/32 
    驗證中      : zabbix-agent-3.4.11-1.el7.x86_64                                                          20/32 
    驗證中      : unixODBC-2.3.1-11.el7.x86_64                                                              21/32 
    驗證中      : apr-util-1.5.2-6.el7.x86_64                                                               22/32 
    驗證中      : php-gd-5.4.16-45.el7.x86_64                                                               23/32 
    驗證中      : dejavu-sans-fonts-2.33-6.el7.noarch                                                       24/32 
    驗證中      : php-mysql-5.4.16-45.el7.x86_64                                                            25/32 
    驗證中      : apr-1.4.8-3.el7_4.1.x86_64                                                                26/32 
    驗證中      : php-common-5.4.16-45.el7.x86_64                                                           27/32 
    驗證中      : php-mbstring-5.4.16-45.el7.x86_64                                                         28/32 
    驗證中      : zabbix-web-mysql-3.4.11-1.el7.noarch                                                      29/32 
    驗證中      : iksemel-1.4-2.el7.centos.x86_64                                                           30/32 
    驗證中      : libzip-0.10.1-8.el7.x86_64                                                                31/32 
    驗證中      : zabbix-get-3.4.11-1.el7.x86_64                                                            32/32 
  ​
  已安裝:
    zabbix-agent.x86_64 0:3.4.11-1.el7                          zabbix-get.x86_64 0:3.4.11-1.el7                  
    zabbix-server-mysql.x86_64 0:3.4.11-1.el7                   zabbix-web.noarch 0:3.4.11-1.el7                  
    zabbix-web-mysql.noarch 0:3.4.11-1.el7                     
  ​
  作為依賴被安裝:
    OpenIPMI-libs.x86_64 0:2.0.23-2.el7                   OpenIPMI-modalias.x86_64 0:2.0.23-2.el7                 
    apr.x86_64 0:1.4.8-3.el7_4.1                          apr-util.x86_64 0:1.5.2-6.el7                           
    dejavu-fonts-common.noarch 0:2.33-6.el7               dejavu-sans-fonts.noarch 0:2.33-6.el7                   
    fping.x86_64 0:3.10-4.el7                             gnutls.x86_64 0:3.3.26-9.el7                            
    httpd.x86_64 0:2.4.6-80.el7.centos.1                  httpd-tools.x86_64 0:2.4.6-80.el7.centos.1              
    iksemel.x86_64 0:1.4-2.el7.centos                     libzip.x86_64 0:0.10.1-8.el7                            
    mailcap.noarch 0:2.1.41-2.el7                         nettle.x86_64 0:2.7.1-8.el7                             
    php.x86_64 0:5.4.16-45.el7                            php-bcmath.x86_64 0:5.4.16-45.el7                       
    php-cli.x86_64 0:5.4.16-45.el7                        php-common.x86_64 0:5.4.16-45.el7                       
    php-gd.x86_64 0:5.4.16-45.el7                         php-ldap.x86_64 0:5.4.16-45.el7                         
    php-mbstring.x86_64 0:5.4.16-45.el7                   php-mysql.x86_64 0:5.4.16-45.el7                        
    php-pdo.x86_64 0:5.4.16-45.el7                        php-xml.x86_64 0:5.4.16-45.el7                          
    t1lib.x86_64 0:5.1.2-14.el7                           trousers.x86_64 0:0.3.14-2.el7                          
    unixODBC.x86_64 0:2.3.1-11.el7                       
  ​
  完畢!
  [root@zyshanlinux-001 ~]#

zabbix系統基於PHP環境執行,所以前提是系統上有PHP的執行環境,lnmp或者lamp環境

  [root@zyshanlinux-001 yum.repos.d]# ps aux |grep mysql
  root      1213  0.0  0.0 115428  1712 ?        S    07:42   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/zyshanlinux-001.pid
  mysql     1380  0.0 24.6 1125928 461796 ?      Sl   07:42   0:10 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/zyshanlinux-001.err --pid-file=/data/mysql/zyshanlinux-001.pid --socket=/tmp/mysql.sock
  root     11932  0.0  0.0 112724   972 pts/0    S+   10:59   0:00 grep --color=auto mysql
  [root@zyshanlinux-001 yum.repos.d]# ps aux |grep nginx
  root      1135  0.0  0.0  46032  1276 ?        Ss   07:42   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  nobody    1140  0.0  0.2  48520  4176 ?        S    07:42   0:00 nginx: worker process
  nobody    1141  0.0  0.2  48520  3920 ?        S    07:42   0:00 nginx: worker process
  root     11934  0.0  0.0 112720   972 pts/0    R+   10:59   0:00 grep --color=auto nginx
  [root@zyshanlinux-001 yum.repos.d]# 
  [root@zyshanlinux-001 yum.repos.d]# ps aux |grep mariadb
  root     11936  0.0  0.0 112720   972 pts/0    R+   11:00   0:00 grep --color=auto mariadb
  [root@zyshanlinux-001 yum.repos.d]# ps aux |grep php
  root      1471  0.0  0.2 227252  4948 ?        Ss   07:42   0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
  php-fpm   1472  0.0  0.2 227252  4708 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1473  0.0  0.2 227252  4708 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1474  0.0  0.2 227252  4708 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1475  0.0  0.2 227252  4708 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1476  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1477  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1478  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1479  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1480  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1481  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1482  0.0  0.2 227252  4712 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1483  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1484  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1485  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1486  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1487  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1488  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1489  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1490  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  php-fpm   1491  0.0  0.2 227252  4716 ?        S    07:42   0:00 php-fpm: pool www
  root     11958  0.0  0.0 112720   972 pts/0    R+   11:03   0:00 grep --color=auto php

設定預設的字符集

  vim /etc/my.cnf //需要增加配置
  character_set_server = utf8

更改配置,需要重啟mysql服務

  [root@zyshanlinux-001 ~]# systemctl restart mysql

重啟mysqld服務後,進入mysql命令列

  [root@zyshanlinux-001 ~]# mysql -uroot -pmysql01
  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 3
  Server version: 5.6.35-log MySQL Community Server (GPL)
  ​
  Copyright (c) 2000, 2016, 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>

建立zabbix庫的時候指定字元utf8

  mysql> create database zabbix character set utf8;
  Query OK, 1 row affected (0.04 sec)
  ​
  mysql>

再建立使用者,該使用者需要讓web程式碼(就是PHP程式碼)連線mysql,還有就是監控中心(zabbix)連線mysql,再退出

  mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zyshan-zabbix';
  Query OK, 0 rows affected (0.04 sec)
  ​
  mysql>quit
  Bye

匯入資料,到安裝目錄去把create.sql.gz包解壓,匯入到資料,資料量不小匯入時間不短。

  [root@zyshanlinux-001 ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/
  [root@zyshanlinux-001 zabbix-server-mysql-3.2.11]# ls
  AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README
  [root@zyshanlinux-001 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz
  [root@zyshanlinux-001 zabbix-server-mysql-3.2.11]# ls
  AUTHORS  ChangeLog  COPYING  create.sql  NEWS  README
  [root@zyshanlinux-001 zabbix-server-mysql-3.2.11]# mysql -uroot -pmysql01 zabbix < create.sql
  Warning: Using a password on the command line interface can be insecure.
  [root@zyshanlinux-001 zabbix-server-mysql-3.2.11]#

啟動zabbix服務,啟動httpd服務,先確認80埠沒被佔用;現在80被nginx佔用需要停止該服務,釋放80埠。

  [root@zyshanlinux-001 zabbix-server-mysql-3.2.11]# cd
  [root@zyshanlinux-001 ~]# systemctl start zabbix-server
  [root@zyshanlinux-001 ~]# ps aux |grep nginx
  root      1135  0.0  0.0  46032  1276 ?        Ss   07:42   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  nobody    1140  0.0  0.2  48520  4176 ?        S    07:42   0:00 nginx: worker process
  nobody    1141  0.0  0.2  48520  3920 ?        S    07:42   0:00 nginx: worker process
  root     12335  0.0  0.0 112720   968 pts/0    R+   11:29   0:00 grep --color=auto nginx
  [root@zyshanlinux-001 ~]# /etc/init.d/nginx stop
  Stopping nginx (via systemctl):                            [  確定  ]
  [root@zyshanlinux-001 ~]# ps aux |grep nginx
  root     12356  0.0  0.0 112720   964 pts/0    R+   11:32   0:00 grep --color=auto nginx
  [root@zyshanlinux-001 ~]# netstat -lntp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
  tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      573/rpcbind         
  tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1035/rpc.mountd     
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1013/sshd           
  tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1424/master         
  tcp        0      0 0.0.0.0:39577           0.0.0.0:*               LISTEN      -                   
  tcp        0      0 0.0.0.0:40729           0.0.0.0:*               LISTEN      1027/rpc.statd      
  tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
  tcp6       0      0 :::111                  :::*                    LISTEN      573/rpcbind         
  tcp6       0      0 :::20048                :::*                    LISTEN      1035/rpc.mountd     
  tcp6       0      0 :::22                   :::*                    LISTEN      1013/sshd           
  tcp6       0      0 ::1:25                  :::*                    LISTEN      1424/master         
  tcp6       0      0 :::40347                :::*                    LISTEN      -                   
  tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
  tcp6       0      0 :::48193                :::*                    LISTEN      1027/rpc.statd      
  tcp6       0      0 :::3306                 :::*                    LISTEN      12232/mysqld

啟動httpd服務,確認80埠是被httpd佔用

  [root@zyshanlinux-001 ~]# systemctl start httpd
  [root@zyshanlinux-001 ~]# netstat -lntp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
  tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      573/rpcbind         
  tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1035/rpc.mountd     
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1013/sshd           
  tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1424/master         
  tcp        0      0 0.0.0.0:39577           0.0.0.0:*               LISTEN      -                   
  tcp        0      0 0.0.0.0:40729           0.0.0.0:*               LISTEN      1027/rpc.statd      
  tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
  tcp6       0      0 :::111                  :::*                    LISTEN      573/rpcbind         
  tcp6       0      0 :::80                   :::*                    LISTEN      12370/httpd         
  tcp6       0      0 :::20048                :::*                    LISTEN      1035/rpc.mountd     
  tcp6       0      0 :::22                   :::*                    LISTEN      1013/sshd           
  tcp6       0      0 ::1:25                  :::*                    LISTEN      1424/master         
  tcp6       0      0 :::40347                :::*                    LISTEN      -                   
  tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
  tcp6       0      0 :::48193                :::*                    LISTEN      1027/rpc.statd      
  tcp6       0      0 :::3306                 :::*                    LISTEN      12232/mysqld

把httpd和zabbix服務配置開機啟動,把nginx服務取消開機啟動。

  [root@zyshanlinux-001 ~]# systemctl enable httpd
  Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
  [root@zyshanlinux-001 ~]# systemctl enable zabbix-server
  Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
  [root@zyshanlinux-001 ~]# systemctl disable nginx
  nginx.service is not a native service, redirecting to /sbin/chkconfig.
  Executing /sbin/chkconfig nginx off
  [root@zyshanlinux-001 ~]# chkconfig nginx off

確認zabbix服務是否啟動,服務啟動管理埠沒有監聽,檢視錯誤日誌,沒有連線mysql需要配置下檔案。

  [root@zyshanlinux-001 ~]# ps aux |grep zabbix
  zabbix   12332  0.0  0.1 254632  3492 ?        S    11:28   0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
  root     12514  0.0  0.0 112720   968 pts/0    R+   11:40   0:00 grep --color=auto zabbix
  [root@zyshanlinux-001 ~]# netstat -lntp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
  tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      573/rpcbind         
  tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1035/rpc.mountd     
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1013/sshd           
  tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1424/master         
  tcp        0      0 0.0.0.0:39577           0.0.0.0:*               LISTEN      -                   
  tcp        0      0 0.0.0.0:40729           0.0.0.0:*               LISTEN      1027/rpc.statd      
  tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
  tcp6       0      0 :::111                  :::*                    LISTEN      573/rpcbind         
  tcp6       0      0 :::80                   :::*                    LISTEN      12370/httpd         
  tcp6       0      0 :::20048                :::*                    LISTEN      1035/rpc.mountd     
  tcp6       0      0 :::22                   :::*                    LISTEN      1013/sshd           
  tcp6       0      0 ::1:25                  :::*                    LISTEN      1424/master         
  tcp6       0      0 :::40347                :::*                    LISTEN      -                   
  tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
  tcp6       0      0 :::48193                :::*                    LISTEN      1027/rpc.statd      
  tcp6       0      0 :::3306                 :::*                    LISTEN      12232/mysqld
  ​
  ​
  [root@zyshanlinux-001 ~]# less /var/log/zabbix/zabbix_server.log
  erver through socket '/var/lib/mysql/mysql.sock' (2)
   12332:20180726:112926.610 database is down: reconnecting in 10 seconds
   12332:20180726:112936.611 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL s

vim /etc/zabbix/zabbix_server.conf //修改或增加

DBHost=127.0.0.1 //在DBName=zabbix上面增加

DBPassword=a-zyshanabbix //在DBuser下面增加

更改配置後需要重啟一下服務

  [root@zyshanlinux-001 ~]# systemctl restart zabbix-server

再次確認zabbix服務開啟和埠監聽

  [root@zyshanlinux-001 ~]# ps aux |grep zabbix
  zabbix   12634  0.6  0.2 254812  4184 ?        S    12:00   0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
  zabbix   12637  0.0  0.1 254820  3068 ?        S    12:00   0:00 /usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.011986 sec, idle 60 sec]
  zabbix   12638  0.0  0.1 254812  2892 ?        S    12:00   0:00 /usr/sbin/zabbix_server: db watchdog [synced alerts config in 0.003214 sec, idle 60 sec]
  zabbix   12639  0.0  0.2 361748  5264 ?        S    12:00   0:00 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000012 sec, idle 5 sec]
  zabbix   12640  0.0  0.2 361748  5264 ?        S    12:00   0:00 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000007 sec, idle 5 sec]
  zabbix   12641  0.0  0.2 361748  5264 ?        S    12:00   0:00 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000008 sec, idle 5 sec]
  zabbix   12642  0.0  0.2 361748  5264 ?        S    12:00   0:00 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000008 sec, idle 5 sec]
  zabbix   12643  0.0  0.2 361748  5264 ?        S    12:00   0:00 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000008 sec, idle 5 sec]
  zabbix   12644  0.0  0.2 361748  5264 ?        S    12:00   0:00 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000008 sec, idle 5 sec]
  zabbix   12645  0.0  0.1 254812  3624 ?        S    12:00   0:00 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]
  zabbix   12646  0.0  0.1 254812  3624 ?        S    12:00   0:00 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
  zabbix   12647  0.0  0.1 254812  3624 ?        S    12:00   0:00 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
  zabbix   12648  0.0  0.1 254812  3624 ?        S    12:00   0:00 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
  zabbix   12649  0.0  0.1 254812  3624 ?        S    12:00   0:00 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
  zabbix   12653  0.0  0.1 257384  2688 ?        S    12:00   0:00 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000008 sec, idle 5 sec]
  zabbix   12654  0.0  0.1 254812  2880 ?        S    12:00   0:00 /usr/sbin/zabbix_server: alerter [sent alerts: 0 success, 0 fail in 0.001612 sec, idle 30 sec]
  zabbix   12656  0.0  0.1 254812  2512 ?        S    12:00   0:00 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
  zabbix   12657  0.0  0.1 254888  2996 ?        S    12:00   0:00 /usr/sbin/zabbix_server: timer #1 [processed 0 triggers, 0 events in 0.000036 sec, 0 maintenances in 0.000000 sec, idle 30 sec]
  zabbix   12659  0.0  0.1 254812  2896 ?        S    12:00   0:00 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.001314 sec, idle 5 sec]
  zabbix   12661  0.0  0.2 359280  5252 ?        S    12:00   0:00 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.001446 sec, idle 60 sec]
  zabbix   12662  0.0  0.1 254812  2888 ?        S    12:00   0:00 /usr/sbin/zabbix_server: history syncer #1 [synced 0 items in 0.000003 sec, idle 1 sec]
  zabbix   12663  0.0  0.1 254812  2888 ?        S    12:00   0:00 /usr/sbin/zabbix_server: history syncer #2 [synced 0 items in 0.000003 sec, idle 1 sec]
  zabbix   12666  0.0  0.1 254812  2888 ?        S    12:00   0:00 /usr/sbin/zabbix_server: history syncer #3 [synced 0 items in 0.000003 sec, idle 1 sec]
  zabbix   12675  0.0  0.1 254812  2888 ?        S    12:00   0:00 /usr/sbin/zabbix_server: history syncer #4 [synced 0 items in 0.000003 sec, idle 1 sec]
  zabbix   12677  0.0  0.2 254812  3828 ?        S    12:00   0:00 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.001538 sec, idle 3 sec]
  zabbix   12679  0.0  0.2 254812  3832 ?        S    12:00   0:00 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000005 sec, idle 5 sec]
  zabbix   12680  0.0  0.1 254812  2656 ?        S    12:00   0:00 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000009 sec, idle 1 sec]
  zabbix   12682  0.0  0.1 254812  2876 ?        S    12:00   0:00 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.000748 sec, idle 5 sec]
  root     12687  0.0  0.0 112720   968 pts/0    R+   12:01   0:00 grep --color=auto zabbix
  [root@zyshanlinux-001 ~]# netstat -lntp
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
  tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      573/rpcbind         
  tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1035/rpc.mountd     
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1013/sshd           
  tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1424/master         
  tcp        0      0 0.0.0.0:39577           0.0.0.0:*               LISTEN      -                   
  tcp        0      0 0.0.0.0:40729           0.0.0.0:*               LISTEN      1027/rpc.statd      
  tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
  tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      12634/zabbix_server 
  tcp6       0      0 :::111                  :::*                    LISTEN      573/rpcbind         
  tcp6       0      0 :::80                   :::*                    LISTEN      12370/httpd         
  tcp6       0      0 :::20048                :::*                    LISTEN      1035/rpc.mountd     
  tcp6       0      0 :::22                   :::*                    LISTEN      1013/sshd           
  tcp6       0      0 ::1:25                  :::*                    LISTEN      1424/master         
  tcp6       0      0 :::40347                :::*                    LISTEN      -                   
  tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
  tcp6       0      0 :::48193                :::*                    LISTEN      1027/rpc.statd      
  tcp6       0      0 :::10051                :::*                    LISTEN      12634/zabbix_server 
  tcp6       0      0 :::3306                 :::*                    LISTEN      12232/mysqld

瀏覽器訪問http://ip/zabbix/ ,yum安裝不需要配置什麼,直接就可以進入web頁面非常方便;編譯安裝則需要配置

web介面下面配置zabbix,顯示OK的不用管,只看Fail的,提示PHP option "date.timezone"

配置php的檔案,加上data.timezone = Asia/Shanghai

  [root@zyshanlinux-001 ~]# vi /etc/php.ini

更改完配置需要重啟httpd服務

  [root@zyshanlinux-001 ~]# systemctl restart httpd

重新整理網頁,Fail變為OK了

配置埠賬戶資訊

定義zabbix的主機名,隨意

安裝成功

用預設賬戶:admin,密碼:zabbix 登入

進入後臺第一