zabbix4.0介绍及安装

监控介绍

为什么要做监控?

可以提前发现潜在故障隐患,第一时间解决掉。把影响降低。

常见的监控软件:

cacti :Cacti是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具。人性化比较好;https://www.cacti.net/index.php

nagios :https://www.nagios.org

zaabix :中文社区http://www.zabbix.org.cn

open-falcon :小米公司研发的https://github.com/open-falcon-archive

prometheus :普罗米修斯https://blog.csdn.net/lijiaocn/article/details/81865120

grafana :成图可以混合使用https://grafana.com


系统CentOS 7        安装zabbix4.0        数据库使用MySQL

zabbix 官网 https://www.zabbix.com/

zabbix4.0 官方安装步骤:

https://www.zabbix.com/cn/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql

个人安装方法:

1、安装 yum源 数据库

  1 
  2 [root@localhost ~]# rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
  3 获取https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
  4 准备中...                          ################################# [100%]
  5 	软件包 zabbix-release-4.0-1.el7.noarch 已经安装
  6 [root@localhost ~]#
#rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm //安装阿里云的zabbix源库

这个需要更改一下yum内的地址:

    将:/etc/yum.repo.s/zabbix.repo内的 http://repo.zabbix.com/ 替换为: https://mirrors.aliyun.com/zabbix/

方法:

sed -i 's#http://repo.zabbix.com/#https://mirrors.aliyun.com/zabbix/#g' /etc/yum.repos.d/zabbix.repo

     清除yum缓存

  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8   1 [root@localhost ~]# yum clean all
  9   2 已加载插件:fastestmirror
 10   3 正在清理软件源: base extras mysql-connectors-community
 11   4                : mysql-tools-community mysql56-community updates
 12   5 Cleaning up list of fastest mirrors
 13   6 Other repos take up 792 k of disk space (use --verbose for details)
 14   7 [root@localhost ~]#
 15 # yum clean all //清除yum缓存
# yum clean all //清除yum缓存


2、安装Zabbix server,Web前端,agent ,get , agent

[root@localhost yum.repos.d]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-agent
已加载插件:fastestmirror
base                                           | 3.6 kB     00:00
extras                                         | 2.9 kB     00:00
updates                                        | 2.9 kB     00:00
zabbix                                         | 2.9 kB     00:00
zabbix-non-supported                           |  951 B     00:00
(1/5): base/7/x86_64/group_gz                    | 165 kB   00:00
(2/5): extras/7/x86_64/primary_db                | 152 kB   00:00
(3/5): zabbix/x86_64/primary_db                  |  98 kB   00:00
(4/5): updates/7/x86_64/primary_db               | 1.1 MB   00:00
(5/5): base/7/x86_64/primary_db                  | 6.0 MB   00:01
zabbix-non-supported/x86_64/primary              | 1.6 kB   00:00
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: ap.stykers.moe
zabbix-non-supported                                              4/4
正在解决依赖关系
--> 正在检查事务
---> 软件包 zabbix-agent.x86_64.0.4.0.12-1.el7 将被 安装
---> 软件包 zabbix-get.x86_64.0.4.0.12-1.el7 将被 安装
---> 软件包 zabbix-server-mysql.x86_64.0.4.0.12-1.el7 将被 安装
--> 正在处理依赖关系 fping,它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
--> 正在处理依赖关系 libnetsnmp.so.31()(64bit),它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
--> 正在处理依赖关系 libiksemel.so.3()(64bit),它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
--> 正在处理依赖关系 libOpenIPMIposix.so.0()(64bit),它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
--> 正在处理依赖关系 libevent-2.0.so.5()(64bit),它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
--> 正在处理依赖关系 libOpenIPMI.so.0()(64bit),它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
--> 正在处理依赖关系 libodbc.so.2()(64bit),它被软件包 zabbix-server-mysql-4.0.12-1.el7.x86_64 需要
---> 软件包 zabbix-web-mysql.noarch.0.4.0.12-1.el7 将被 安装
--> 正在处理依赖关系 zabbix-web = 4.0.12-1.el7,它被软件包 zabbix-web-mysql-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 php-mysql,它被软件包 zabbix-web-mysql-4.0.12-1.el7.noarch 需要
--> 正在检查事务
---> 软件包 OpenIPMI-libs.x86_64.0.2.0.27-1.el7 将被 安装
--> 正在处理依赖关系 OpenIPMI-modalias = 2.0.27-1.el7,它被软件包 OpenIPMI-libs-2.0.27-1.el7.x86_64 需要
---> 软件包 fping.x86_64.0.3.10-1.el7 将被 安装
---> 软件包 iksemel.x86_64.0.1.4-2.el7.centos 将被 安装
---> 软件包 libevent.x86_64.0.2.0.21-4.el7 将被 安装
---> 软件包 net-snmp-libs.x86_64.1.5.7.2-43.el7 将被 安装
---> 软件包 php-mysql.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 php-pdo(x86-64) = 5.4.16-46.el7,它被软件包 php-mysql-5.4.16-46.el7.x86_64 需要
---> 软件包 unixODBC.x86_64.0.2.3.1-14.el7 将被 安装
--> 正在处理依赖关系 libltdl.so.7()(64bit),它被软件包 unixODBC-2.3.1-14.el7.x86_64 需要
---> 软件包 zabbix-web.noarch.0.4.0.12-1.el7 将被 安装
--> 正在处理依赖关系 php >= 5.4,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 php-ldap,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 httpd,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 php-gd,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 php-mbstring,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 dejavu-sans-fonts,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 php-bcmath,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在处理依赖关系 php-xml,它被软件包 zabbix-web-4.0.12-1.el7.noarch 需要
--> 正在检查事务
---> 软件包 OpenIPMI-modalias.x86_64.0.2.0.27-1.el7 将被 安装
--> 正在处理依赖关系 OpenIPMI,它被软件包 OpenIPMI-modalias-2.0.27-1.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 需要
---> 软件包 httpd.x86_64.0.2.4.6-90.el7.centos 将被 安装
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
---> 软件包 libtool-ltdl.x86_64.0.2.4.2-22.el7_3 将被 安装
---> 软件包 php.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 php-common(x86-64) = 5.4.16-46.el7,它被软件包 php-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 php-cli(x86-64) = 5.4.16-46.el7,它被软件包 php-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libcrypto.so.10(OPENSSL_1.0.2)(64bit),它被软件包 php-5.4.16-46.el7.x86_64 需要
---> 软件包 php-bcmath.x86_64.0.5.4.16-46.el7 将被 安装
---> 软件包 php-gd.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 libpng15.so.15(PNG15_0)(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libjpeg.so.62(LIBJPEG_6.2)(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libt1.so.5()(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libpng15.so.15()(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libjpeg.so.62()(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libXpm.so.4()(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libX11.so.6()(64bit),它被软件包 php-gd-5.4.16-46.el7.x86_64 需要
---> 软件包 php-ldap.x86_64.0.5.4.16-46.el7 将被 安装
---> 软件包 php-mbstring.x86_64.0.5.4.16-46.el7 将被 安装
---> 软件包 php-pdo.x86_64.0.5.4.16-46.el7 将被 安装
---> 软件包 php-xml.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.24)(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.22)(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.18)(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.13)(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.11)(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1()(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 libexslt.so.0()(64bit),它被软件包 php-xml-5.4.16-46.el7.x86_64 需要
--> 正在检查事务
---> 软件包 OpenIPMI.x86_64.0.2.0.27-1.el7 将被 安装
---> 软件包 dejavu-fonts-common.noarch.0.2.33-6.el7 将被 安装
--> 正在处理依赖关系 fontpackages-filesystem,它被软件包 dejavu-fonts-common-2.33-6.el7.noarch 需要
---> 软件包 libX11.x86_64.0.1.6.7-2.el7 将被 安装
--> 正在处理依赖关系 libX11-common >= 1.6.7-2.el7,它被软件包 libX11-1.6.7-2.el7.x86_64 需要
--> 正在处理依赖关系 libxcb.so.1()(64bit),它被软件包 libX11-1.6.7-2.el7.x86_64 需要
---> 软件包 libXpm.x86_64.0.3.5.12-1.el7 将被 安装
---> 软件包 libjpeg-turbo.x86_64.0.1.2.90-8.el7 将被 安装
---> 软件包 libpng.x86_64.2.1.5.13-7.el7_2 将被 安装
---> 软件包 libxslt.x86_64.0.1.1.28-5.el7 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
---> 软件包 openssl-libs.x86_64.1.1.0.1e-34.el7 将被 升级
--> 正在处理依赖关系 openssl-libs(x86-64) = 1:1.0.1e-34.el7,它被软件包 1:openssl-1.0.1e-34.el7.x86_64 需要
---> 软件包 openssl-libs.x86_64.1.1.0.2k-19.el7 将被 更新
---> 软件包 php-cli.x86_64.0.5.4.16-46.el7 将被 安装
---> 软件包 php-common.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 libzip.so.2()(64bit),它被软件包 php-common-5.4.16-46.el7.x86_64 需要
---> 软件包 t1lib.x86_64.0.5.1.2-14.el7 将被 安装
--> 正在检查事务
---> 软件包 fontpackages-filesystem.noarch.0.1.44-8.el7 将被 安装
---> 软件包 libX11-common.noarch.0.1.6.7-2.el7 将被 安装
---> 软件包 libxcb.x86_64.0.1.13-1.el7 将被 安装
--> 正在处理依赖关系 libXau.so.6()(64bit),它被软件包 libxcb-1.13-1.el7.x86_64 需要
---> 软件包 libzip.x86_64.0.0.10.1-8.el7 将被 安装
---> 软件包 openssl.x86_64.1.1.0.1e-34.el7 将被 升级
---> 软件包 openssl.x86_64.1.1.0.2k-19.el7 将被 更新
--> 正在检查事务
---> 软件包 libXau.x86_64.0.1.0.8-2.1.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

======================================================================
 Package                 架构   版本                源           大小
======================================================================
正在安装:
 zabbix-agent            x86_64 4.0.12-1.el7        zabbix      412 k
 zabbix-get              x86_64 4.0.12-1.el7        zabbix      286 k
 zabbix-server-mysql     x86_64 4.0.12-1.el7        zabbix      2.1 M
 zabbix-web-mysql        noarch 4.0.12-1.el7        zabbix      8.8 k
为依赖而安装:
 OpenIPMI                x86_64 2.0.27-1.el7        base        243 k
 OpenIPMI-libs           x86_64 2.0.27-1.el7        base        523 k
 OpenIPMI-modalias       x86_64 2.0.27-1.el7        base         16 k
 dejavu-fonts-common     noarch 2.33-6.el7          base         64 k
 dejavu-sans-fonts       noarch 2.33-6.el7          base        1.4 M
 fontpackages-filesystem noarch 1.44-8.el7          base        9.9 k
 fping                   x86_64 3.10-1.el7          zabbix-non-supported
                                                                 40 k
 httpd                   x86_64 2.4.6-90.el7.centos base        2.7 M
 iksemel                 x86_64 1.4-2.el7.centos    zabbix-non-supported
                                                                 49 k
 libX11                  x86_64 1.6.7-2.el7         base        607 k
 libX11-common           noarch 1.6.7-2.el7         base        164 k
 libXau                  x86_64 1.0.8-2.1.el7       base         29 k
 libXpm                  x86_64 3.5.12-1.el7        base         55 k
 libevent                x86_64 2.0.21-4.el7        base        214 k
 libjpeg-turbo           x86_64 1.2.90-8.el7        base        135 k
 libpng                  x86_64 2:1.5.13-7.el7_2    base        213 k
 libtool-ltdl            x86_64 2.4.2-22.el7_3      base         49 k
 libxcb                  x86_64 1.13-1.el7          base        214 k
 libxslt                 x86_64 1.1.28-5.el7        base        242 k
 libzip                  x86_64 0.10.1-8.el7        base         48 k
 mailcap                 noarch 2.1.41-2.el7        base         31 k
 net-snmp-libs           x86_64 1:5.7.2-43.el7      base        750 k
 php                     x86_64 5.4.16-46.el7       base        1.4 M
 php-bcmath              x86_64 5.4.16-46.el7       base         58 k
 php-cli                 x86_64 5.4.16-46.el7       base        2.7 M
 php-common              x86_64 5.4.16-46.el7       base        565 k
 php-gd                  x86_64 5.4.16-46.el7       base        128 k
 php-ldap                x86_64 5.4.16-46.el7       base         53 k
 php-mbstring            x86_64 5.4.16-46.el7       base        505 k
 php-mysql               x86_64 5.4.16-46.el7       base        101 k
 php-pdo                 x86_64 5.4.16-46.el7       base         99 k
 php-xml                 x86_64 5.4.16-46.el7       base        126 k
 t1lib                   x86_64 5.1.2-14.el7        base        166 k
 unixODBC                x86_64 2.3.1-14.el7        base        413 k
 zabbix-web              noarch 4.0.12-1.el7        zabbix      2.8 M
为依赖而更新:
 openssl                 x86_64 1:1.0.2k-19.el7     base        493 k
 openssl-libs            x86_64 1:1.0.2k-19.el7     base        1.2 M

事务概要
======================================================================
安装  4 软件包 (+35 依赖软件包)
升级           (  2 依赖软件包)

总下载量:21 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/41): OpenIPMI-modalias-2.0.27-1.el7.x86_64.rp |  16 kB   00:00
(2/41): OpenIPMI-2.0.27-1.el7.x86_64.rpm         | 243 kB   00:00
(3/41): dejavu-fonts-common-2.33-6.el7.noarch.rp |  64 kB   00:00
(4/41): fontpackages-filesystem-1.44-8.el7.noarc | 9.9 kB   00:00
(5/41): OpenIPMI-libs-2.0.27-1.el7.x86_64.rpm    | 523 kB   00:00
warning: /var/cache/yum/x86_64/7/zabbix-non-supported/packages/fping-3.10-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
fping-3.10-1.el7.x86_64.rpm 的公钥尚未安装
(6/41): fping-3.10-1.el7.x86_64.rpm              |  40 kB   00:00
(7/41): iksemel-1.4-2.el7.centos.x86_64.rpm      |  49 kB   00:00
(8/41): dejavu-sans-fonts-2.33-6.el7.noarch.rpm  | 1.4 MB   00:00
(9/41): libX11-1.6.7-2.el7.x86_64.rpm            | 607 kB   00:00
(10/41): libX11-common-1.6.7-2.el7.noarch.rpm    | 164 kB   00:00
(11/41): libXpm-3.5.12-1.el7.x86_64.rpm          |  55 kB   00:00
(12/41): httpd-2.4.6-90.el7.centos.x86_64.rpm    | 2.7 MB   00:01
(13/41): libXau-1.0.8-2.1.el7.x86_64.rpm         |  29 kB   00:00
(14/41): libevent-2.0.21-4.el7.x86_64.rpm        | 214 kB   00:00
(15/41): libjpeg-turbo-1.2.90-8.el7.x86_64.rpm   | 135 kB   00:00
(16/41): libpng-1.5.13-7.el7_2.x86_64.rpm        | 213 kB   00:00
(17/41): libxcb-1.13-1.el7.x86_64.rpm            | 214 kB   00:00
(18/41): libzip-0.10.1-8.el7.x86_64.rpm          |  48 kB   00:00
(19/41): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm  |  49 kB   00:00
(20/41): mailcap-2.1.41-2.el7.noarch.rpm         |  31 kB   00:00
(21/41): net-snmp-libs-5.7.2-43.el7.x86_64.rpm   | 750 kB   00:00
(22/41): libxslt-1.1.28-5.el7.x86_64.rpm         | 242 kB   00:00
(23/41): openssl-libs-1.0.2k-19.el7.x86_64.rpm   | 1.2 MB   00:00
(24/41): php-bcmath-5.4.16-46.el7.x86_64.rpm     |  58 kB   00:00
(25/41): openssl-1.0.2k-19.el7.x86_64.rpm        | 493 kB   00:00
(26/41): php-cli-5.4.16-46.el7.x86_64.rpm        | 2.7 MB   00:00
(27/41): php-common-5.4.16-46.el7.x86_64.rpm     | 565 kB   00:00
(28/41): php-ldap-5.4.16-46.el7.x86_64.rpm       |  53 kB   00:00
(29/41): php-gd-5.4.16-46.el7.x86_64.rpm         | 128 kB   00:00
(30/41): php-mbstring-5.4.16-46.el7.x86_64.rpm   | 505 kB   00:00
(31/41): php-mysql-5.4.16-46.el7.x86_64.rpm      | 101 kB   00:00
(32/41): php-5.4.16-46.el7.x86_64.rpm            | 1.4 MB   00:01
(33/41): php-pdo-5.4.16-46.el7.x86_64.rpm        |  99 kB   00:00
(34/41): php-xml-5.4.16-46.el7.x86_64.rpm        | 126 kB   00:00
(35/41): t1lib-5.1.2-14.el7.x86_64.rpm           | 166 kB   00:00
(36/41): unixODBC-2.3.1-14.el7.x86_64.rpm        | 413 kB   00:00
warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-4.0.12-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
zabbix-agent-4.0.12-1.el7.x86_64.rpm 的公钥尚未安装
(37/41): zabbix-agent-4.0.12-1.el7.x86_64.rpm    | 412 kB   00:00
(38/41): zabbix-get-4.0.12-1.el7.x86_64.rpm      | 286 kB   00:00
(39/41): zabbix-server-mysql-4.0.12-1.el7.x86_64 | 2.1 MB   00:00
(40/41): zabbix-web-mysql-4.0.12-1.el7.noarch.rp | 8.8 kB   00:00
(41/41): zabbix-web-4.0.12-1.el7.noarch.rpm      | 2.8 MB   00:00
----------------------------------------------------------------------
总计                                     3.6 MB/s |  21 MB  00:05
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX 检索密钥
导入 GPG key 0x79EA5ED4:
 用户ID     : "Zabbix SIA <packager@zabbix.com>"
 指纹       : fbab d5fb 2025 5eca b22e e194 d13d 58e4 79ea 5ed4
 软件包     : zabbix-release-4.0-1.el7.noarch (installed)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 检索密钥
导入 GPG key 0xA14FE591:
 用户ID     : "Zabbix LLC <packager@zabbix.com>"
 指纹       : a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
 软件包     : zabbix-release-4.0-1.el7.noarch (installed)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在更新    : 1:openssl-libs-1.0.2k-19.el7.x86_64              1/43
  正在安装    : 1:net-snmp-libs-5.7.2-43.el7.x86_64              2/43
  正在安装    : OpenIPMI-2.0.27-1.el7.x86_64                     3/43
  正在安装    : OpenIPMI-modalias-2.0.27-1.el7.x86_64            4/43
  正在安装    : OpenIPMI-libs-2.0.27-1.el7.x86_64                5/43
  正在安装    : libevent-2.0.21-4.el7.x86_64                     6/43
  正在安装    : libzip-0.10.1-8.el7.x86_64                       7/43
  正在安装    : php-common-5.4.16-46.el7.x86_64                  8/43
  正在安装    : php-ldap-5.4.16-46.el7.x86_64                    9/43
  正在安装    : php-bcmath-5.4.16-46.el7.x86_64                 10/43
  正在安装    : php-mbstring-5.4.16-46.el7.x86_64               11/43
  正在安装    : php-pdo-5.4.16-46.el7.x86_64                    12/43
  正在安装    : php-mysql-5.4.16-46.el7.x86_64                  13/43
  正在安装    : php-cli-5.4.16-46.el7.x86_64                    14/43
  正在安装    : libXau-1.0.8-2.1.el7.x86_64                     15/43
  正在安装    : libxcb-1.13-1.el7.x86_64                        16/43
  正在安装    : iksemel-1.4-2.el7.centos.x86_64                 17/43
  正在安装    : libxslt-1.1.28-5.el7.x86_64                     18/43
  正在安装    : php-xml-5.4.16-46.el7.x86_64                    19/43
  正在安装    : libjpeg-turbo-1.2.90-8.el7.x86_64               20/43
  正在安装    : libX11-common-1.6.7-2.el7.noarch                21/43
  正在安装    : libX11-1.6.7-2.el7.x86_64                       22/43
  正在安装    : libXpm-3.5.12-1.el7.x86_64                      23/43
  正在安装    : t1lib-5.1.2-14.el7.x86_64                       24/43
  正在安装    : libtool-ltdl-2.4.2-22.el7_3.x86_64              25/43
  正在安装    : unixODBC-2.3.1-14.el7.x86_64                    26/43
  正在安装    : fontpackages-filesystem-1.44-8.el7.noarch       27/43
  正在安装    : dejavu-fonts-common-2.33-6.el7.noarch           28/43
  正在安装    : dejavu-sans-fonts-2.33-6.el7.noarch             29/43
  正在安装    : 2:libpng-1.5.13-7.el7_2.x86_64                  30/43
  正在安装    : php-gd-5.4.16-46.el7.x86_64                     31/43
  正在安装    : mailcap-2.1.41-2.el7.noarch                     32/43
  正在安装    : httpd-2.4.6-90.el7.centos.x86_64                33/43
  正在安装    : php-5.4.16-46.el7.x86_64                        34/43
  正在安装    : zabbix-web-mysql-4.0.12-1.el7.noarch            35/43
  正在安装    : zabbix-web-4.0.12-1.el7.noarch                  36/43
  正在安装    : fping-3.10-1.el7.x86_64                         37/43
  正在安装    : zabbix-server-mysql-4.0.12-1.el7.x86_64         38/43
  正在安装    : zabbix-get-4.0.12-1.el7.x86_64                  39/43
  正在更新    : 1:openssl-1.0.2k-19.el7.x86_64                  40/43
  正在安装    : zabbix-agent-4.0.12-1.el7.x86_64                41/43
  清理        : 1:openssl-1.0.1e-34.el7.x86_64                  42/43
  清理        : 1:openssl-libs-1.0.1e-34.el7.x86_64             43/43
WARNING: ipmi_devintf module isn't available.
WARNING: ipmi_msghandler module isn't available.
  验证中      : fping-3.10-1.el7.x86_64                          1/43
  验证中      : mailcap-2.1.41-2.el7.noarch                      2/43
  验证中      : php-mysql-5.4.16-46.el7.x86_64                   3/43
  验证中      : httpd-2.4.6-90.el7.centos.x86_64                 4/43
  验证中      : unixODBC-2.3.1-14.el7.x86_64                     5/43
  验证中      : 2:libpng-1.5.13-7.el7_2.x86_64                   6/43
  验证中      : fontpackages-filesystem-1.44-8.el7.noarch        7/43
  验证中      : php-xml-5.4.16-46.el7.x86_64                     8/43
  验证中      : OpenIPMI-modalias-2.0.27-1.el7.x86_64            9/43
  验证中      : 1:openssl-libs-1.0.2k-19.el7.x86_64             10/43
  验证中      : 1:net-snmp-libs-5.7.2-43.el7.x86_64             11/43
  验证中      : dejavu-fonts-common-2.33-6.el7.noarch           12/43
  验证中      : libtool-ltdl-2.4.2-22.el7_3.x86_64              13/43
  验证中      : libX11-1.6.7-2.el7.x86_64                       14/43
  验证中      : libX11-common-1.6.7-2.el7.noarch                15/43
  验证中      : libxcb-1.13-1.el7.x86_64                        16/43
  验证中      : php-ldap-5.4.16-46.el7.x86_64                   17/43
  验证中      : libXpm-3.5.12-1.el7.x86_64                      18/43
  验证中      : libjpeg-turbo-1.2.90-8.el7.x86_64               19/43
  验证中      : t1lib-5.1.2-14.el7.x86_64                       20/43
  验证中      : libxslt-1.1.28-5.el7.x86_64                     21/43
  验证中      : zabbix-get-4.0.12-1.el7.x86_64                  22/43
  验证中      : libevent-2.0.21-4.el7.x86_64                    23/43
  验证中      : php-bcmath-5.4.16-46.el7.x86_64                 24/43
  验证中      : php-mbstring-5.4.16-46.el7.x86_64               25/43
  验证中      : php-gd-5.4.16-46.el7.x86_64                     26/43
  验证中      : dejavu-sans-fonts-2.33-6.el7.noarch             27/43
  验证中      : 1:openssl-1.0.2k-19.el7.x86_64                  28/43
  验证中      : zabbix-agent-4.0.12-1.el7.x86_64                29/43
  验证中      : php-pdo-5.4.16-46.el7.x86_64                    30/43
  验证中      : zabbix-web-4.0.12-1.el7.noarch                  31/43
  验证中      : zabbix-server-mysql-4.0.12-1.el7.x86_64         32/43
  验证中      : OpenIPMI-2.0.27-1.el7.x86_64                    33/43
  验证中      : zabbix-web-mysql-4.0.12-1.el7.noarch            34/43
  验证中      : iksemel-1.4-2.el7.centos.x86_64                 35/43
  验证中      : libXau-1.0.8-2.1.el7.x86_64                     36/43
  验证中      : php-cli-5.4.16-46.el7.x86_64                    37/43
  验证中      : libzip-0.10.1-8.el7.x86_64                      38/43
  验证中      : php-5.4.16-46.el7.x86_64                        39/43
  验证中      : OpenIPMI-libs-2.0.27-1.el7.x86_64               40/43
  验证中      : php-common-5.4.16-46.el7.x86_64                 41/43
  验证中      : 1:openssl-libs-1.0.1e-34.el7.x86_64             42/43
  验证中      : 1:openssl-1.0.1e-34.el7.x86_64                  43/43

已安装:
  zabbix-agent.x86_64 0:4.0.12-1.el7
  zabbix-get.x86_64 0:4.0.12-1.el7
  zabbix-server-mysql.x86_64 0:4.0.12-1.el7
  zabbix-web-mysql.noarch 0:4.0.12-1.el7

作为依赖被安装:
  OpenIPMI.x86_64 0:2.0.27-1.el7
  OpenIPMI-libs.x86_64 0:2.0.27-1.el7
  OpenIPMI-modalias.x86_64 0:2.0.27-1.el7
  dejavu-fonts-common.noarch 0:2.33-6.el7
  dejavu-sans-fonts.noarch 0:2.33-6.el7
  fontpackages-filesystem.noarch 0:1.44-8.el7
  fping.x86_64 0:3.10-1.el7
  httpd.x86_64 0:2.4.6-90.el7.centos
  iksemel.x86_64 0:1.4-2.el7.centos
  libX11.x86_64 0:1.6.7-2.el7
  libX11-common.noarch 0:1.6.7-2.el7
  libXau.x86_64 0:1.0.8-2.1.el7
  libXpm.x86_64 0:3.5.12-1.el7
  libevent.x86_64 0:2.0.21-4.el7
  libjpeg-turbo.x86_64 0:1.2.90-8.el7
  libpng.x86_64 2:1.5.13-7.el7_2
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3
  libxcb.x86_64 0:1.13-1.el7
  libxslt.x86_64 0:1.1.28-5.el7
  libzip.x86_64 0:0.10.1-8.el7
  mailcap.noarch 0:2.1.41-2.el7
  net-snmp-libs.x86_64 1:5.7.2-43.el7
  php.x86_64 0:5.4.16-46.el7
  php-bcmath.x86_64 0:5.4.16-46.el7
  php-cli.x86_64 0:5.4.16-46.el7
  php-common.x86_64 0:5.4.16-46.el7
  php-gd.x86_64 0:5.4.16-46.el7
  php-ldap.x86_64 0:5.4.16-46.el7
  php-mbstring.x86_64 0:5.4.16-46.el7
  php-mysql.x86_64 0:5.4.16-46.el7
  php-pdo.x86_64 0:5.4.16-46.el7
  php-xml.x86_64 0:5.4.16-46.el7
  t1lib.x86_64 0:5.1.2-14.el7
  unixODBC.x86_64 0:2.3.1-14.el7
  zabbix-web.noarch 0:4.0.12-1.el7

作为依赖被升级:
  openssl.x86_64 1:1.0.2k-19.el7  openssl-libs.x86_64 1:1.0.2k-19.el7

完毕!
[root@localhost yum.repos.d]#
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-agent


3、数据库操作

数据库安装:

-3.1 安装MySQL源:

-3.2 安装MySQL数据库

[root@localhost byk]# yum -y install mysql-community-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.jdcloud.com
 * updates: mirror.jdcloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.6.45-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.45-2.el7,它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.6.10,它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(Data::Dumper),它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在处理依赖关系 libaio.so.1(LIBAIO_0.4)(64bit),它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在处理依赖关系 libaio.so.1(LIBAIO_0.1)(64bit),它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在处理依赖关系 libaio.so.1()(64bit),它被软件包 mysql-community-server-5.6.45-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libaio.x86_64.0.0.3.109-13.el7 将被 安装
---> 软件包 mariadb.x86_64.1.5.5.64-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.6.45-2.el7 将被 舍弃
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.6.10,它被软件包 mysql-community-client-5.6.45-2.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.6.45-2.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
---> 软件包 perl-Data-Dumper.x86_64.0.2.145-3.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.64-1.el7 将被 取代
---> 软件包 mysql-community-libs.x86_64.0.5.6.45-2.el7 将被 舍弃
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Zlib),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在检查事务
---> 软件包 perl-IO-Compress.noarch.0.2.061-2.el7 将被 安装
--> 正在处理依赖关系 perl(Compress::Raw::Zlib) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Raw::Bzip2) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Compress-Raw-Bzip2.x86_64.0.2.061-3.el7 将被 安装
---> 软件包 perl-Compress-Raw-Zlib.x86_64.1.2.061-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

======================================================================
 Package                架构   版本           源                 大小
======================================================================
正在安装:
 mysql-community-client x86_64 5.6.45-2.el7   mysql56-community  20 M
      替换  mariadb.x86_64 1:5.5.64-1.el7
 mysql-community-libs   x86_64 5.6.45-2.el7   mysql56-community 2.0 M
      替换  mariadb-libs.x86_64 1:5.5.64-1.el7
 mysql-community-server x86_64 5.6.45-2.el7   mysql56-community  60 M
为依赖而安装:
 libaio                 x86_64 0.3.109-13.el7 base               24 k
 mysql-community-common x86_64 5.6.45-2.el7   mysql56-community 257 k
 perl-Compress-Raw-Bzip2
                        x86_64 2.061-3.el7    base               32 k
 perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7  base               57 k
 perl-DBI               x86_64 1.627-4.el7    base              802 k
 perl-Data-Dumper       x86_64 2.145-3.el7    base               47 k
 perl-IO-Compress       noarch 2.061-2.el7    base              260 k
 perl-Net-Daemon        noarch 0.48-5.el7     base               51 k
 perl-PlRPC             noarch 0.2020-14.el7  base               36 k

事务概要
======================================================================
安装  3 软件包 (+9 依赖软件包)

总下载量:83 M
Downloading packages:
(1/12): libaio-0.3.109-13.el7.x86_64.rpm         |  24 kB   00:00
warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.45-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
mysql-community-common-5.6.45-2.el7.x86_64.rpm 的公钥尚未安装
(2/12): mysql-community-common-5.6.45-2.el7.x86_ | 257 kB   00:01
(3/12): mysql-community-libs-5.6.45-2.el7.x86_64 | 2.0 MB   00:01
(4/12): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_ |  32 kB   00:00
(5/12): perl-DBI-1.627-4.el7.x86_64.rpm          | 802 kB   00:00
(6/12): perl-Data-Dumper-2.145-3.el7.x86_64.rpm  |  47 kB   00:00
(7/12): perl-Compress-Raw-Zlib-2.061-4.el7.x86_6 |  57 kB   00:00
(8/12): perl-Net-Daemon-0.48-5.el7.noarch.rpm    |  51 kB   00:00
(9/12): perl-PlRPC-0.2020-14.el7.noarch.rpm      |  36 kB   00:00
(10/12): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB   00:00
(11/12): mysql-community-client-5.6.45-2.el7.x86 |  20 MB   00:09
(12/12): mysql-community-server-5.6.45-2.el7.x86 |  60 MB   00:27
----------------------------------------------------------------------
总计                                     2.8 MB/s |  83 MB  00:30
从 file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
 用户ID     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 指纹       : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 软件包     : mysql-community-release-el7-5.noarch (installed)
 来自       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : perl-Data-Dumper-2.145-3.el7.x86_64              1/14
  正在安装    : mysql-community-common-5.6.45-2.el7.x86_64       2/14
  正在安装    : mysql-community-libs-5.6.45-2.el7.x86_64         3/14
  正在安装    : mysql-community-client-5.6.45-2.el7.x86_64       4/14
  正在安装    : libaio-0.3.109-13.el7.x86_64                     5/14
  正在安装    : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64      6/14
  正在安装    : perl-Net-Daemon-0.48-5.el7.noarch                7/14
  正在安装    : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64       8/14
  正在安装    : perl-IO-Compress-2.061-2.el7.noarch              9/14
  正在安装    : perl-PlRPC-0.2020-14.el7.noarch                 10/14
  正在安装    : perl-DBI-1.627-4.el7.x86_64                     11/14
  正在安装    : mysql-community-server-5.6.45-2.el7.x86_64      12/14
  正在删除    : 1:mariadb-5.5.64-1.el7.x86_64                   13/14
  正在删除    : 1:mariadb-libs-5.5.64-1.el7.x86_64              14/14
  验证中      : mysql-community-common-5.6.45-2.el7.x86_64       1/14
  验证中      : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64       2/14
  验证中      : perl-Net-Daemon-0.48-5.el7.noarch                3/14
  验证中      : perl-Data-Dumper-2.145-3.el7.x86_64              4/14
  验证中      : mysql-community-server-5.6.45-2.el7.x86_64       5/14
  验证中      : perl-IO-Compress-2.061-2.el7.noarch              6/14
  验证中      : mysql-community-libs-5.6.45-2.el7.x86_64         7/14
  验证中      : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64      8/14
  验证中      : mysql-community-client-5.6.45-2.el7.x86_64       9/14
  验证中      : perl-DBI-1.627-4.el7.x86_64                     10/14
  验证中      : libaio-0.3.109-13.el7.x86_64                    11/14
  验证中      : perl-PlRPC-0.2020-14.el7.noarch                 12/14
  验证中      : 1:mariadb-libs-5.5.64-1.el7.x86_64              13/14
  验证中      : 1:mariadb-5.5.64-1.el7.x86_64                   14/14

已安装:
  mysql-community-client.x86_64 0:5.6.45-2.el7
  mysql-community-libs.x86_64 0:5.6.45-2.el7
  mysql-community-server.x86_64 0:5.6.45-2.el7

作为依赖被安装:
  libaio.x86_64 0:0.3.109-13.el7
  mysql-community-common.x86_64 0:5.6.45-2.el7
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
  perl-DBI.x86_64 0:1.627-4.el7
  perl-Data-Dumper.x86_64 0:2.145-3.el7
  perl-IO-Compress.noarch 0:2.061-2.el7
  perl-Net-Daemon.noarch 0:0.48-5.el7
  perl-PlRPC.noarch 0:0.2020-14.el7

替代:
  mariadb.x86_64 1:5.5.64-1.el7   mariadb-libs.x86_64 1:5.5.64-1.el7

完毕!
[root@localhost byk]#
yum -y install mysql-community-server //按MySQL数据库服务

-3.3 进入MySQL

  1 [root@localhost byk]# mysql
  2 Welcome to the MySQL monitor.  Commands end with ; or \g.
  3 Your MySQL connection id is 4
  4 Server version: 5.6.45 MySQL Community Server (GPL)
  5 
  6 Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  7 
  8 Oracle is a registered trademark of Oracle Corporation and/or its
  9 affiliates. Other names may be trademarks of their respective
 10 owners.
 11 
 12 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 13 
 14 mysql> set password for 'root'@'localhost'=password('mysqlroot');       //设置MySQL的root密码;
 15 
 16 Query OK, 0 rows affected (0.00 sec)
 17 
 18 mysql> create database zabbix character set utf8 collate utf8_bin;      // 创建zabbix数据表格式为utf8;
 19 Query OK, 1 row affected (0.00 sec)
 20 
 21 mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'mysqlzabbix';    //设置zabbix数据库的密码为mysqlzabbix;
 22 Query OK, 0 rows affected (0.00 sec)
 23 
 24 mysql> quit;       //退出MySQL;
 25 Bye
 26 [root@localhost byk]#
关于MySQL内,有注解的可以操作;

-3.4 导入初始架构和数据,系统将提示输入密码  是刚创建的zabbix的MySQL密码;

  1 [root@localhost byk]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix       //导入初始架构和数据 这里的 -uzabbix是原文件的用户,-pzabbix是原文件的密码;
  2 Enter password:              //自己设置的MySQL的zabbix用户的密码;
  3 [root@localhost byk]#
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix //初始化数据库,需要等数据导完;


4、zabbix server数据库配置

编辑配置文件  /etc/zabbix/zabbix_server.conf

  1 [root@localhost byk]# sed -i  '/# DBPassword/a\\DBPassword=mysqlzabbix' /etc/zabbix/zabbix_server.conf        //修改数据库密码
  2 [root@localhost byk]# sed -i  '/# DBPassword/a\\' /etc/zabbix/zabbix_server.conf       //增加空白行

查看配置文件:

  1 
  2 [root@localhost byk]# cat /etc/zabbix/zabbix_server.conf
  3 # This is a configuration file for Zabbix server daemon
  4 # To get more information about Zabbix, visit http://www.zabbix.com
  5 
  6 ############ GENERAL PARAMETERS #################
  7 
  8 ### Option: ListenPort
  9 #	Listen port for trapper.
 10 #
 11 # Mandatory: no
 12 # Range: 1024-32767
 13 # Default:
 14 # ListenPort=10051
 15 
 16 ### Option: SourceIP
 17 #	Source IP address for outgoing connections.
 18 #
 19 # Mandatory: no
 20 # Default:
 21 # SourceIP=
 22 
 23 ### Option: LogType
 24 #	Specifies where log messages are written to:
 25 #		system  - syslog
 26 #		file    - file specified with LogFile parameter
 27 #		console - standard output
 28 #
 29 # Mandatory: no
 30 # Default:
 31 # LogType=file
 32 
 33 ### Option: LogFile
 34 #	Log file name for LogType 'file' parameter.
 35 #
 36 # Mandatory: yes, if LogType is set to file, otherwise no
 37 # Default:
 38 # LogFile=
 39 
 40 LogFile=/var/log/zabbix/zabbix_server.log
 41 
 42 ### Option: LogFileSize
 43 #	Maximum size of log file in MB.
 44 #	0 - disable automatic log rotation.
 45 #
 46 # Mandatory: no
 47 # Range: 0-1024
 48 # Default:
 49 # LogFileSize=1
 50 
 51 LogFileSize=0
 52 
 53 ### Option: DebugLevel
 54 #	Specifies debug level:
 55 #	0 - basic information about starting and stopping of Zabbix processes
 56 #	1 - critical information
 57 #	2 - error information
 58 #	3 - warnings
 59 #	4 - for debugging (produces lots of information)
 60 #	5 - extended debugging (produces even more information)
 61 #
 62 # Mandatory: no
 63 # Range: 0-5
 64 # Default:
 65 # DebugLevel=3
 66 
 67 ### Option: PidFile
 68 #	Name of PID file.
 69 #
 70 # Mandatory: no
 71 # Default:
 72 # PidFile=/tmp/zabbix_server.pid
 73 
 74 PidFile=/var/run/zabbix/zabbix_server.pid
 75 
 76 ### Option: SocketDir
 77 #	IPC socket directory.
 78 #       Directory to store IPC sockets used by internal Zabbix services.
 79 #
 80 # Mandatory: no
 81 # Default:
 82 # SocketDir=/tmp
 83 
 84 SocketDir=/var/run/zabbix
 85 
 86 ### Option: DBHost
 87 #	Database host name.
 88 #	If set to localhost, socket is used for MySQL.
 89 #	If set to empty string, socket is used for PostgreSQL.
 90 #
 91 # Mandatory: no
 92 # Default:
 93 # DBHost=localhost
 94 
 95 ### Option: DBName
 96 #	Database name.
 97 #
 98 # Mandatory: yes
 99 # Default:
100 # DBName=
101 
102 DBName=zabbix
103 
104 ### Option: DBSchema
105 #	Schema name. Used for IBM DB2 and PostgreSQL.
106 #
107 # Mandatory: no
108 # Default:
109 # DBSchema=
110 
111 ### Option: DBUser
112 #	Database user.
113 #
114 # Mandatory: no
115 # Default:
116 # DBUser=
117 
118 DBUser=zabbix
119 
120 ### Option: DBPassword
121 #	Database password.
122 #	Comment this line if no password is used.
123 #
124 # Mandatory: no
125 # Default:
126 # DBPassword=
127 
128 DBPassword=mysqlzabbix
129 
130 
131 
132 
133 ### Option: DBSocket
134 #	Path to MySQL socket.
135 #
136 # Mandatory: no
137 # Default:
138 # DBSocket=
139 
140 ### Option: DBPort
141 #	Database port when not using local socket.
142 #
143 # Mandatory: no
144 # Range: 1024-65535
145 # Default:
146 # DBPort=
147 
148 ### Option: HistoryStorageURL
149 #	History storage HTTP[S] URL.
150 #
151 # Mandatory: no
152 # Default:
153 # HistoryStorageURL=
154 
155 ### Option: HistoryStorageTypes
156 #	Comma separated list of value types to be sent to the history storage.
157 #
158 # Mandatory: no
159 # Default:
160 # HistoryStorageTypes=uint,dbl,str,log,text
161 
162 ### Option: HistoryStorageDateIndex
163 #	Enable preprocessing of history values in history storage to store values in different indices based on date.
164 #	0 - disable
165 #	1 - enable
166 #
167 # Mandatory: no
168 # Default:
169 # HistoryStorageDateIndex=0
170 
171 ### Option: ExportDir
172 #	Directory for real time export of events, history and trends in newline delimited JSON format.
173 #	If set, enables real time export.
174 #
175 # Mandatory: no
176 # Default:
177 # ExportDir=
178 
179 ### Option: ExportFileSize
180 #	Maximum size per export file in bytes.
181 #	Only used for rotation if ExportDir is set.
182 #
183 # Mandatory: no
184 # Range: 1M-1G
185 # Default:
186 # ExportFileSize=1G
187 
188 ############ ADVANCED PARAMETERS ################
189 
190 ### Option: StartPollers
191 #	Number of pre-forked instances of pollers.
192 #
193 # Mandatory: no
194 # Range: 0-1000
195 # Default:
196 # StartPollers=5
197 
198 ### Option: StartIPMIPollers
199 #	Number of pre-forked instances of IPMI pollers.
200 #       The IPMI manager process is automatically started when at least one IPMI poller is started.
201 #
202 # Mandatory: no
203 # Range: 0-1000
204 # Default:
205 # StartIPMIPollers=0
206 
207 ### Option: StartPreprocessors
208 #	Number of pre-forked instances of preprocessing workers.
209 #       The preprocessing manager process is automatically started when preprocessor worker is started.
210 #
211 # Mandatory: no
212 # Range: 1-1000
213 # Default:
214 # StartPreprocessors=3
215 
216 ### Option: StartPollersUnreachable
217 #	Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java).
218 #	At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers
219 #	are started.
220 #
221 # Mandatory: no
222 # Range: 0-1000
223 # Default:
224 # StartPollersUnreachable=1
225 
226 ### Option: StartTrappers
227 #	Number of pre-forked instances of trappers.
228 #	Trappers accept incoming connections from Zabbix sender, active agents and active proxies.
229 #	At least one trapper process must be running to display server availability and view queue
230 #	in the frontend.
231 #
232 # Mandatory: no
233 # Range: 0-1000
234 # Default:
235 # StartTrappers=5
236 
237 ### Option: StartPingers
238 #	Number of pre-forked instances of ICMP pingers.
239 #
240 # Mandatory: no
241 # Range: 0-1000
242 # Default:
243 # StartPingers=1
244 
245 ### Option: StartDiscoverers
246 #	Number of pre-forked instances of discoverers.
247 #
248 # Mandatory: no
249 # Range: 0-250
250 # Default:
251 # StartDiscoverers=1
252 
253 ### Option: StartHTTPPollers
254 #	Number of pre-forked instances of HTTP pollers.
255 #
256 # Mandatory: no
257 # Range: 0-1000
258 # Default:
259 # StartHTTPPollers=1
260 
261 ### Option: StartTimers
262 #	Number of pre-forked instances of timers.
263 #	Timers process maintenance periods.
264 #	Only the first timer process handles host maintenance updates. Problem suppression updates are shared
265 #	between all timers.
266 #
267 # Mandatory: no
268 # Range: 1-1000
269 # Default:
270 # StartTimers=1
271 
272 ### Option: StartEscalators
273 #	Number of pre-forked instances of escalators.
274 #
275 # Mandatory: no
276 # Range: 0-100
277 # Default:
278 # StartEscalators=1
279 
280 ### Option: StartAlerters
281 #	Number of pre-forked instances of alerters.
282 #	Alerters send the notifications created by action operations.
283 #
284 # Mandatory: no
285 # Range: 0-100
286 # Default:
287 # StartAlerters=3
288 
289 ### Option: JavaGateway
290 #	IP address (or hostname) of Zabbix Java gateway.
291 #	Only required if Java pollers are started.
292 #
293 # Mandatory: no
294 # Default:
295 # JavaGateway=
296 
297 ### Option: JavaGatewayPort
298 #	Port that Zabbix Java gateway listens on.
299 #
300 # Mandatory: no
301 # Range: 1024-32767
302 # Default:
303 # JavaGatewayPort=10052
304 
305 ### Option: StartJavaPollers
306 #	Number of pre-forked instances of Java pollers.
307 #
308 # Mandatory: no
309 # Range: 0-1000
310 # Default:
311 # StartJavaPollers=0
312 
313 ### Option: StartVMwareCollectors
314 #	Number of pre-forked vmware collector instances.
315 #
316 # Mandatory: no
317 # Range: 0-250
318 # Default:
319 # StartVMwareCollectors=0
320 
321 ### Option: VMwareFrequency
322 #	How often Zabbix will connect to VMware service to obtain a new data.
323 #
324 # Mandatory: no
325 # Range: 10-86400
326 # Default:
327 # VMwareFrequency=60
328 
329 ### Option: VMwarePerfFrequency
330 #	How often Zabbix will connect to VMware service to obtain performance data.
331 #
332 # Mandatory: no
333 # Range: 10-86400
334 # Default:
335 # VMwarePerfFrequency=60
336 
337 ### Option: VMwareCacheSize
338 #	Size of VMware cache, in bytes.
339 #	Shared memory size for storing VMware data.
340 #	Only used if VMware collectors are started.
341 #
342 # Mandatory: no
343 # Range: 256K-2G
344 # Default:
345 # VMwareCacheSize=8M
346 
347 ### Option: VMwareTimeout
348 #	Specifies how many seconds vmware collector waits for response from VMware service.
349 #
350 # Mandatory: no
351 # Range: 1-300
352 # Default:
353 # VMwareTimeout=10
354 
355 ### Option: SNMPTrapperFile
356 #	Temporary file used for passing data from SNMP trap daemon to the server.
357 #	Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file.
358 #
359 # Mandatory: no
360 # Default:
361 # SNMPTrapperFile=/tmp/zabbix_traps.tmp
362 
363 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
364 
365 ### Option: StartSNMPTrapper
366 #	If 1, SNMP trapper process is started.
367 #
368 # Mandatory: no
369 # Range: 0-1
370 # Default:
371 # StartSNMPTrapper=0
372 
373 ### Option: ListenIP
374 #	List of comma delimited IP addresses that the trapper should listen on.
375 #	Trapper will listen on all network interfaces if this parameter is missing.
376 #
377 # Mandatory: no
378 # Default:
379 # ListenIP=0.0.0.0
380 
381 # ListenIP=127.0.0.1
382 
383 ### Option: HousekeepingFrequency
384 #	How often Zabbix will perform housekeeping procedure (in hours).
385 #	Housekeeping is removing outdated information from the database.
386 #	To prevent Housekeeper from being overloaded, no more than 4 times HousekeepingFrequency
387 #	hours of outdated information are deleted in one housekeeping cycle, for each item.
388 #	To lower load on server startup housekeeping is postponed for 30 minutes after server start.
389 #	With HousekeepingFrequency=0 the housekeeper can be only executed using the runtime control option.
390 #	In this case the period of outdated information deleted in one housekeeping cycle is 4 times the
391 #	period since the last housekeeping cycle, but not less than 4 hours and not greater than 4 days.
392 #
393 # Mandatory: no
394 # Range: 0-24
395 # Default:
396 # HousekeepingFrequency=1
397 
398 ### Option: MaxHousekeeperDelete
399 #	The table "housekeeper" contains "tasks" for housekeeping procedure in the format:
400 #	[housekeeperid], [tablename], [field], [value].
401 #	No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename], [field], [value])
402 #	will be deleted per one task in one housekeeping cycle.
403 #	If set to 0 then no limit is used at all. In this case you must know what you are doing!
404 #
405 # Mandatory: no
406 # Range: 0-1000000
407 # Default:
408 # MaxHousekeeperDelete=5000
409 
410 ### Option: CacheSize
411 #	Size of configuration cache, in bytes.
412 #	Shared memory size for storing host, item and trigger data.
413 #
414 # Mandatory: no
415 # Range: 128K-8G
416 # Default:
417 # CacheSize=8M
418 
419 ### Option: CacheUpdateFrequency
420 #	How often Zabbix will perform update of configuration cache, in seconds.
421 #
422 # Mandatory: no
423 # Range: 1-3600
424 # Default:
425 # CacheUpdateFrequency=60
426 
427 ### Option: StartDBSyncers
428 #	Number of pre-forked instances of DB Syncers.
429 #
430 # Mandatory: no
431 # Range: 1-100
432 # Default:
433 # StartDBSyncers=4
434 
435 ### Option: HistoryCacheSize
436 #	Size of history cache, in bytes.
437 #	Shared memory size for storing history data.
438 #
439 # Mandatory: no
440 # Range: 128K-2G
441 # Default:
442 # HistoryCacheSize=16M
443 
444 ### Option: HistoryIndexCacheSize
445 #	Size of history index cache, in bytes.
446 #	Shared memory size for indexing history cache.
447 #
448 # Mandatory: no
449 # Range: 128K-2G
450 # Default:
451 # HistoryIndexCacheSize=4M
452 
453 ### Option: TrendCacheSize
454 #	Size of trend cache, in bytes.
455 #	Shared memory size for storing trends data.
456 #
457 # Mandatory: no
458 # Range: 128K-2G
459 # Default:
460 # TrendCacheSize=4M
461 
462 ### Option: ValueCacheSize
463 #	Size of history value cache, in bytes.
464 #	Shared memory size for caching item history data requests.
465 #	Setting to 0 disables value cache.
466 #
467 # Mandatory: no
468 # Range: 0,128K-64G
469 # Default:
470 # ValueCacheSize=8M
471 
472 ### Option: Timeout
473 #	Specifies how long we wait for agent, SNMP device or external check (in seconds).
474 #
475 # Mandatory: no
476 # Range: 1-30
477 # Default:
478 # Timeout=3
479 
480 Timeout=4
481 
482 ### Option: TrapperTimeout
483 #	Specifies how many seconds trapper may spend processing new data.
484 #
485 # Mandatory: no
486 # Range: 1-300
487 # Default:
488 # TrapperTimeout=300
489 
490 ### Option: UnreachablePeriod
491 #	After how many seconds of unreachability treat a host as unavailable.
492 #
493 # Mandatory: no
494 # Range: 1-3600
495 # Default:
496 # UnreachablePeriod=45
497 
498 ### Option: UnavailableDelay
499 #	How often host is checked for availability during the unavailability period, in seconds.
500 #
501 # Mandatory: no
502 # Range: 1-3600
503 # Default:
504 # UnavailableDelay=60
505 
506 ### Option: UnreachableDelay
507 #	How often host is checked for availability during the unreachability period, in seconds.
508 #
509 # Mandatory: no
510 # Range: 1-3600
511 # Default:
512 # UnreachableDelay=15
513 
514 ### Option: AlertScriptsPath
515 #	Full path to location of custom alert scripts.
516 #	Default depends on compilation options.
517 #	To see the default path run command "zabbix_server --help".
518 #
519 # Mandatory: no
520 # Default:
521 # AlertScriptsPath=${datadir}/zabbix/alertscripts
522 
523 AlertScriptsPath=/usr/lib/zabbix/alertscripts
524 
525 ### Option: ExternalScripts
526 #	Full path to location of external scripts.
527 #	Default depends on compilation options.
528 #	To see the default path run command "zabbix_server --help".
529 #
530 # Mandatory: no
531 # Default:
532 # ExternalScripts=${datadir}/zabbix/externalscripts
533 
534 ExternalScripts=/usr/lib/zabbix/externalscripts
535 
536 ### Option: FpingLocation
537 #	Location of fping.
538 #	Make sure that fping binary has root ownership and SUID flag set.
539 #
540 # Mandatory: no
541 # Default:
542 # FpingLocation=/usr/sbin/fping
543 
544 ### Option: Fping6Location
545 #	Location of fping6.
546 #	Make sure that fping6 binary has root ownership and SUID flag set.
547 #	Make empty if your fping utility is capable to process IPv6 addresses.
548 #
549 # Mandatory: no
550 # Default:
551 # Fping6Location=/usr/sbin/fping6
552 
553 ### Option: SSHKeyLocation
554 #	Location of public and private keys for SSH checks and actions.
555 #
556 # Mandatory: no
557 # Default:
558 # SSHKeyLocation=
559 
560 ### Option: LogSlowQueries
561 #	How long a database query may take before being logged (in milliseconds).
562 #	Only works if DebugLevel set to 3, 4 or 5.
563 #	0 - don't log slow queries.
564 #
565 # Mandatory: no
566 # Range: 1-3600000
567 # Default:
568 # LogSlowQueries=0
569 
570 LogSlowQueries=3000
571 
572 ### Option: TmpDir
573 #	Temporary directory.
574 #
575 # Mandatory: no
576 # Default:
577 # TmpDir=/tmp
578 
579 ### Option: StartProxyPollers
580 #	Number of pre-forked instances of pollers for passive proxies.
581 #
582 # Mandatory: no
583 # Range: 0-250
584 # Default:
585 # StartProxyPollers=1
586 
587 ### Option: ProxyConfigFrequency
588 #	How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds.
589 #	This parameter is used only for proxies in the passive mode.
590 #
591 # Mandatory: no
592 # Range: 1-3600*24*7
593 # Default:
594 # ProxyConfigFrequency=3600
595 
596 ### Option: ProxyDataFrequency
597 #	How often Zabbix Server requests history data from a Zabbix Proxy in seconds.
598 #	This parameter is used only for proxies in the passive mode.
599 #
600 # Mandatory: no
601 # Range: 1-3600
602 # Default:
603 # ProxyDataFrequency=1
604 
605 ### Option: AllowRoot
606 #	Allow the server to run as 'root'. If disabled and the server is started by 'root', the server
607 #	will try to switch to the user specified by the User configuration option instead.
608 #	Has no effect if started under a regular user.
609 #	0 - do not allow
610 #	1 - allow
611 #
612 # Mandatory: no
613 # Default:
614 # AllowRoot=0
615 
616 ### Option: User
617 #	Drop privileges to a specific, existing user on the system.
618 #	Only has effect if run as 'root' and AllowRoot is disabled.
619 #
620 # Mandatory: no
621 # Default:
622 # User=zabbix
623 
624 ### Option: Include
625 #	You may include individual files or all files in a directory in the configuration file.
626 #	Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
627 #
628 # Mandatory: no
629 # Default:
630 # Include=
631 
632 # Include=/usr/local/etc/zabbix_server.general.conf
633 # Include=/usr/local/etc/zabbix_server.conf.d/
634 # Include=/usr/local/etc/zabbix_server.conf.d/*.conf
635 
636 ### Option: SSLCertLocation
637 #	Location of SSL client certificates.
638 #	This parameter is used only in web monitoring.
639 #	Default depends on compilation options.
640 #	To see the default path run command "zabbix_server --help".
641 #
642 # Mandatory: no
643 # Default:
644 # SSLCertLocation=${datadir}/zabbix/ssl/certs
645 
646 ### Option: SSLKeyLocation
647 #	Location of private keys for SSL client certificates.
648 #	This parameter is used only in web monitoring.
649 #	Default depends on compilation options.
650 #	To see the default path run command "zabbix_server --help".
651 #
652 # Mandatory: no
653 # Default:
654 # SSLKeyLocation=${datadir}/zabbix/ssl/keys
655 
656 ### Option: SSLCALocation
657 #	Override the location of certificate authority (CA) files for SSL server certificate verification.
658 #	If not set, system-wide directory will be used.
659 #	This parameter is used only in web monitoring and SMTP authentication.
660 #
661 # Mandatory: no
662 # Default:
663 # SSLCALocation=
664 
665 ### Option: StatsAllowedIP
666 #	List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances.
667 #	Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests
668 #	will be accepted.
669 #	If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
670 #	and '::/0' will allow any IPv4 or IPv6 address.
671 #	'0.0.0.0/0' can be used to allow any IPv4 address.
672 #	Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
673 #
674 # Mandatory: no
675 # Default:
676 # StatsAllowedIP=
677 
678 ####### LOADABLE MODULES #######
679 
680 ### Option: LoadModulePath
681 #	Full path to location of server modules.
682 #	Default depends on compilation options.
683 #	To see the default path run command "zabbix_server --help".
684 #
685 # Mandatory: no
686 # Default:
687 # LoadModulePath=${libdir}/modules
688 
689 ### Option: LoadModule
690 #	Module to load at server startup. Modules are used to extend functionality of the server.
691 #	Formats:
692 #		LoadModule=<module.so>
693 #		LoadModule=<path/module.so>
694 #		LoadModule=</abs_path/module.so>
695 #	Either the module must be located in directory specified by LoadModulePath or the path must precede the module name.
696 #	If the preceding path is absolute (starts with '/') then LoadModulePath is ignored.
697 #	It is allowed to include multiple LoadModule parameters.
698 #
699 # Mandatory: no
700 # Default:
701 # LoadModule=
702 
703 ####### TLS-RELATED PARAMETERS #######
704 
705 ### Option: TLSCAFile
706 #	Full pathname of a file containing the top-level CA(s) certificates for
707 #	peer certificate verification.
708 #
709 # Mandatory: no
710 # Default:
711 # TLSCAFile=
712 
713 ### Option: TLSCRLFile
714 #	Full pathname of a file containing revoked certificates.
715 #
716 # Mandatory: no
717 # Default:
718 # TLSCRLFile=
719 
720 ### Option: TLSCertFile
721 #	Full pathname of a file containing the server certificate or certificate chain.
722 #
723 # Mandatory: no
724 # Default:
725 # TLSCertFile=
726 
727 ### Option: TLSKeyFile
728 #	Full pathname of a file containing the server private key.
729 #
730 # Mandatory: no
731 # Default:
732 # TLSKeyFile=
733 [root@localhost byk]#
cat /etc/zabbix/zabbix_server.conf //查看配置文件


5、配置zabbix前端配置PHP

编辑配置文件 /etc/httpd/conf.d/zabbix.conf  添加自己的时间区域;我这里直接修改的;

  1 sed -i  '/# php_value date.timezone/a\\        php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf 


6、关闭selinux

临时关闭selinux防火墙

  1 setenforce 0

编辑文件/etc/selinux/config

  1 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config


7、启动Zabbix server和agent进程,并为它们设置开机自启:

  1 # systemctl restart zabbix-server zabbix-agent httpd   //启动服务
  2 # systemctl enable zabbix-server zabbix-agent httpd    //设置开机启动




请参考:

下载Zabbix
https://www.zabbix.com/cn/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql


MySQL安装之yum安装 - Brian_Zhu - 博客园
https://www.cnblogs.com/brianzhu/p/8575243.html

猜你喜欢

转载自www.cnblogs.com/baiyongkun/p/11588880.html