实验十五:zabbix 监控系统的实现fileapi.it.hactcm.edu.cn/wljssj/file/2020/12/2/... ·...

40
《网络运维管理》 / 实验十五:Zabbix 监控系统的实现 河南中医药大学信息技术学院 | 网络与信息系统科研工作室 第1页 《网络运维管理》—— 实验指导书 实验十五:Zabbix 监控系统的实现 一、实验简介 Zabbix 是一套个基于 Web 的提供分布式系统监控以及网络监控功能的企业级的开源解决方 案。本实验通过 VirtualBox 创建虚拟机并安装 Zabbix 监控系统,并实现对本地操作系统的监控。 二、实验目的 1、掌握在 Centos 系统中安装 Zabbix 监控系统的方法; 2、掌握 Zabbix 的配置方法; 3、掌握在 Zabbix 中添加监控的方法; 三、实验理论 1、什么是 Zabbix Zabbix 是一个基于 Web 的提供分布式系统监控以及网络监控功能的企业级的开源解决方案。 Alexei Vladishev 创建了 Zabbix 项目,当前处于活跃开发状态。 Zabbix 可以监控网络和服务的运行状况,利用灵活的告警机制,向用户发送告警邮件,保证异 常问题的快速响应,Zabbix 可利用监控数据提供精准的报告,为用户决策提供科学的数据支撑。 2Zabbix 支持的通迅方式 1agent 通过专用的代理程序进行监控,与常见的 master/agent 模型类似,如果被监控对象支持对应的 agent,推荐首选这种方式。 2ssh/telnet 通过远程控制协议进行监控,比如 ssh 或者 telnet3SNMP 通过 SNMP 协议与被监控对象进行通讯,监控无法安装 agent 的路由器、交换机等设备。 4IPMI 使用 IPMI 协议,通过标准的 IPMI 硬件接口,监控被监控对象的物理特征,比如电压,温度, 风扇状态,电源状态等。 5JMX 通过 JMX 进行监控,JMXJava Management Extensions,即 Java 管理扩展),监控 JVM 拟机时。 3Zabbix 系统的架构 zabbix 支持分布式监控,可把成千上万台的被监控对象分成不同的区域,每个区域中设置一

Upload: others

Post on 01-Feb-2021

17 views

Category:

Documents


0 download

TRANSCRIPT

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 1页

    《网络运维管理》—— 实验指导书

    实验十五:Zabbix 监控系统的实现

    一、实验简介

    Zabbix 是一套个基于 Web 的提供分布式系统监控以及网络监控功能的企业级的开源解决方

    案。本实验通过 VirtualBox 创建虚拟机并安装 Zabbix 监控系统,并实现对本地操作系统的监控。

    二、实验目的

    1、掌握在 Centos 系统中安装 Zabbix 监控系统的方法;

    2、掌握 Zabbix 的配置方法;

    3、掌握在 Zabbix 中添加监控的方法;

    三、实验理论

    1、什么是 Zabbix

    Zabbix 是一个基于 Web 的提供分布式系统监控以及网络监控功能的企业级的开源解决方案。

    Alexei Vladishev 创建了 Zabbix 项目,当前处于活跃开发状态。

    Zabbix 可以监控网络和服务的运行状况,利用灵活的告警机制,向用户发送告警邮件,保证异

    常问题的快速响应,Zabbix 可利用监控数据提供精准的报告,为用户决策提供科学的数据支撑。

    2、Zabbix 支持的通迅方式

    (1)agent

    通过专用的代理程序进行监控,与常见的 master/agent 模型类似,如果被监控对象支持对应的

    agent,推荐首选这种方式。

    (2)ssh/telnet

    通过远程控制协议进行监控,比如 ssh 或者 telnet。

    (3)SNMP

    通过 SNMP 协议与被监控对象进行通讯,监控无法安装 agent 的路由器、交换机等设备。

    (4)IPMI

    使用 IPMI 协议,通过标准的 IPMI 硬件接口,监控被监控对象的物理特征,比如电压,温度,

    风扇状态,电源状态等。

    (5)JMX

    通过 JMX 进行监控,JMX(Java Management Extensions,即 Java 管理扩展),监控 JVM 虚

    拟机时。

    3、Zabbix 系统的架构

    zabbix 支持分布式监控,可把成千上万台的被监控对象分成不同的区域,每个区域中设置一

    http://www.ttlsa.com/monitor/zabbix/

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 2页

    台代理主机,区域内的每个被监控对象的信息被 agent 采集,提交给代理主机,在这个区域内,

    代理主机的作用就好比 zabbix server,这些代理主机为 zabbix proxy,zabbix proxy 再将收集到

    的信息统一提交给真正的 zabbix server 处理,这样,zabbix proxy分摊了 zabbix server 的压力,

    同时还能够通过统一的监控入口,监控所有的对象,zabbix 的架构如图 15-0-1 所示。

    四、实验过程

    图 15-0-1 Zabbix 系统架构

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 3页

    任务一:网络规划

    【任务介绍】

    规划网络部署。

    步骤 1:网络规划

    (1)拓扑规划

    (2)规划网络地址

    根据对网络环境的设计,实验中所用到的网络为实体机所在网络。其网络参数(例如 IP地址、

    默认网关等)可以从网络管理员处获得,具体情况要根据实验环境的实际情况而定。

    此处 Zabbix 服务器的 IP 地址参数设置见表 11-1-1。

    表 15-1-1 DNS 服务器 IP 地址

    序号 主机名称 IP地址 网关

    1 Zabbix-Server 172.20.1.15 / 24 172.20.1.1

    图 15-1-1 网络拓扑

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 4页

    任务 2:在 VirtualBox 中创建虚拟机并安装操作系统

    任务描述:

    在 VirtualBox中创建 1台虚拟机,命名为 Centos7,安装 CentOS 7操作

    系统。

    步骤 1:创建 CentOS 7 系统的虚拟机

    本步骤创建的虚拟机安装 CentOS 7 操作系统,用于配置 Zabbix 服务器。

    (1)下载 CentOS 7 系统镜像文件

    下载 CentOS 7 系统镜像文件,并保存在硬盘上。

    可通过官方网站(https://www.centos.org)获得安装镜像。

    可通过教学云平台(it.hactcm.edu.cn)下载 Centos 7.7 64 位版本镜像。

    (2)新建虚拟机

    打开 VirtualBox,新建虚拟机。主机名为“Centos7”,类型为“Linux”,版本为“Rad

    Hat(64-bit)”。安装时,内存大小为 1024MB,硬盘大小设置为 20GB。将网卡连接方式设为

    “桥接网卡)”。

    步骤 2:在虚拟机上安装 CentOS 7

    在 VirtualBox 中,将 CentOS 7 镜像文件装入虚拟机的光驱,然后完成 CentOS 7 的安装。

    具体过程省略。

    注意:

    在安装 CentOS 7操作系统过程中,会要求用户创建 ROOT 用户的密码,由学生自行设计该

    密码,并注意密码保存,以免后期无法正常登录 CentOS 7 系统。

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 5页

    任务 3:安装 Zabbix

    任务描述:

    在最小化安装的 Centos7虚拟机上,在线安装 Zabbix。

    步骤 1:安装 LAMP 环境

    (1)什么是 LAMP 环境

    LAMP 环境是指在 Linux 操作系统中分别安装 Apache 网页服务器、MySQL/Mariadb 数据库服

    务器和 PHP 开发服务器,以及一些对应的扩展软件。

    LAMP 环境是当前极为流行的搭建动态网站的开源软件系统,拥有良好的稳定性及兼容性。而

    且随着开源软件的蓬勃发展,越来越多的企业和个人选择在 LAMP 开发平台上搭建自己的网站。

    (2)安装 LAMP 环境

    所用命令如下:

    # yum –y install httpd php mariadb-server

    步骤 2:安装配置 SNMP

    (1) 安装 SNMP

    所用命令如下:

    # yum –y install net-snmp

    (2) 备份 snmp 备份文件

    所用命令

    # cp –p /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak

    (3)修改 snmp 配置文件

    命令如下:

    # vi /etc/snmp/snmpd.conf

    在文件 snmpd.conf 文件中修改如下内容:

    # sec.name source community

    com2sec notConfigUser default snmp-zabbix

    将共同体名(community)修改为 snmp-zabbix。

    注意:

    由学生自行设计共同体名,为安全起见,不要使用默认共同体名。

    # name incl/excl subtree mask(optional)

    view systemview included .1.3.6.1

    view systemview included .1.3.6.1.2.1.1

    view systemview included .1.3.6.1.2.1.25.1.1

    添加一行“view systemview included .1.3.6.1”。

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 6页

    snmpd.conf 配置如图 15-3-1 所示。

    步骤 3:下载 Zabbix 源

    使用 yum 在线安装 Zabbix 需要配置 yum 源,也就是在/etc/yum.repos.d 目录新建一个.repo

    文件。Zabbix 官方有设置好的 yum 源,只需要安装一个 rpm 包即可。

    所用命令如下:

    # rpm –Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-

    5.0-1.el7.noarch.rpm

    如图 15-3-2 所示,安装上述 rpm 包后,/etc/yum.repos.d 目录多了一个 zabbix.repo 文件。

    步骤 4:安装 Server and Agent

    所用命令如下:

    # yum install –y zabbix-server-mysql zabbix-agent

    如果出现图 15-3-3 所示的错误,则更换 zabbix.repo 文件中的 yum 仓库源。

    图 15-3-1 snmpd.conf 配置

    图 15-3-2 /etc/yum.repos.d 目录

    图 15-3-3 安装失败

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 7页

    命令如下:

    # vi /etc/yum.repos.d/zabbix.repo

    在文件 zabbix.repo 文件中修改如下内容:

    [zabbix]

    name=Zabbix Official Repository - $basearch

    #baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/

    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/

    enabled=1

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

    # 将默认 baseurl 注释掉,添加一条指向阿里云的 zabbix 仓库的 baseurl 命令。

    [zabbix-frontend]

    name=Zabbix Official Repository frontend - $basearch

    #baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend

    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend

    enabled=0

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

    # 同样,将默认 baseurl 注释掉,添加一条指向阿里云的 zabbix 仓库的 baseurl 命令。

    [zabbix-debuginfo]

    name=Zabbix Official Repository debuginfo - $basearch

    baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/

    enabled=0

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

    gpgcheck=1

    [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

    步骤 5:安装 Zabbix 前端

    (1)配置 SCL 源

    所用命令如下:

    # yum install centos-release-scl -y

    关于 Software Collections(SCL)

    红帽为它的企业版 linux(RHEL)和社区版分支——CentOS,提供 10年的生命周期,

    这意味着 RHEL/CentOS 的每个版本会提供长达 10年的安全更新。虽然这么长的生命周期

    为企业用户提供了迫切需要的系统兼容性和可靠性,但也存在一个缺点:

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 8页

    随着底层的 RHEL/CentOS 版本接近生命周期的结束,核心应用和运行时环境变得陈

    旧过时。例如 CentOS 6.5,它的生命周期结束时间是 2020 年 11 月 30日,其所携带的

    Python 2.6.6 和 MySQL 5.1.73,以今天的标准来看已经非常古老了。

    另一方面,在 RHEL/CentOS 上试图手动升级开发工具链和运行时环境存在使系统崩

    溃的潜在可能,除非所有依赖都被正确解决。通常情况下,手动升级都是不推荐的,除非

    你知道你在干什么。

    Software Collections(SCL)源出现了,以帮助解决 RHEL/CentOS 下的这种问题。

    SCL 的创建就是为了给 RHEL/CentOS 用户提供一种以方便、安全地安装和使用应用程序

    和运行时环境的多个(而且可能是更新的)版本的方式,同时避免把系统搞乱。与之相对

    的是第三方源,它们可能会在已安装的包之间引起冲突。

    配置 SCL 源,只需执行:

    yum install centos-release-scl

    要启用和运行 SCL 中的应用,你还需要安装下列包:

    yum install scl-utils-build

    安装 SCl中的应用,就像通常安装包那样使用 yum安装。

    例如,安装 pytho 3.3:

    yum install –y python33

    任何时候你都可以查看从 SCL 中安装的包的列表,只需执行:

    scl --list

    SCL 的优点之一是安装其中的包不会覆盖任何系统文件,并且保证不会引起与系统中

    其它库和应用的冲突。

    例如,你已经安装了 pytho 2.6,如果你使用通常的方法那样使用 yum 安装 python

    3.3,那么 python 3.3就会覆盖 python 2.6。如果按照 SCL中的 python 3.3,则 python

    3.3可以和 python 2.6 共存。

    如果想使用一个已经安装的 SCL 包,你需要在每个命令中使用 scl 命令显式启用

    (LCTT 译注:即想在哪条命令中使用 SCL 中的包,就得通过 scl 命令执行该命令)

    scl enable

    例如,如果想在启用从 SCL安装的 python33 包:

    scl enable python33 ‘python –version’

    如果想在启用 python33 包时执行多条命令,你可以像下面那样创建一个启用 SCL

    的 bash 会话:

    scl enable python33 bash

    (2)编辑 zabbix.repo 源文件

    将 zabbix.repo 文件中的[zabbix-frontend]组激活,也即设置 enabled=1。

    命令如下:

    # vi /etc/yum.repos.d/zabbix.repo

    … …

    [zabbix-frontend]

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 9页

    name=Zabbix Official Repository frontend - $basearch

    #baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend

    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend

    enabled=0

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

    … …

    #设置 enabled=1

    (3)按照 zabbix 前端包

    所用命令如下:

    # yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl

    步骤 6:调整防火墙规则并关闭 SELinux

    提醒:

    运行 Zabbix 需要关闭 SELinux,否正会出现错误。

    (1)调整防火墙规则,允许访问 tcp 80、tcp 10051 端口

    所用命令如下:

    # 使用命令修改防火墙配置文件,允许访问 tcp 80 端口

    # firewall-cmd --add-port=80/tcp –permanent

    # 允许访问 tcp 10051 端口,zabbix server 监听这个端口·

    # firewall-cmd --add-port=10051/tcp –permanent

    # 重新加载防火墙配置文件

    # firewall-cmd --reload

    # 查看当前防火墙规则

    # firewall-cmd --list-all

    查看当前防火墙规则如图 15-3-4 所示。

    (1)关闭 SELinux

    所用命令如下:

    图 15-3-4查看当前防火墙规则

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 10页

    # 关闭 SELinux

    # setenforce 0

    # 查看当前 SELinux 状态

    # getenforec

    # 修改 SELinux 配置文件

    # vi /etc/selinux/conf

    # 将 SELINUX=enforcing 修改为 SELINUX=disabled

    查看当前 SELinux 状态如图 15-3-5 所示,修改 SELinux 配置文件如图 15-3-6 所示。

    修改配置文件为:

    注意:

    1. 不加--permanent 选项,只会改变当前防火墙规则,系统重启后配置会消失;只有

    修改配置文件,系统重启会配置才不会失效。添--permanent 选项之后,只会修改

    防火墙配置文件,只有重新加载配置文件,新规则才会生效。

    2. setenforce 0 只会修改当前 SELinux 模式,需要修改 SELinux 配置文件,以使其永

    久生效。

    图 15-3-5 查看当前 SELinux 状态

    图 15-3-6修改 SELinux配置文件

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 11页

    任务 4:配置 Zabbix

    任务描述:

    完成 Zabbix运行所需的配置,使得 Zabbix正确运行。

    步骤 1:启动 snmpd、httpd 与 mariadb

    命令如下:

    # systemctl start snmp httpd mariadb

    # systemctl enable snmp httpd mariadb

    步骤 2:创建初始数据库

    (1)设置 mariadb 数据库的 root 用户密码

    所用命令

    # mysqladmin –uroot password ‘mairadb@root’

    注意:

    数据库 root密码由学生自行设置,注意密码保存,以免后期无法登录数据库。

    (2)使用 root 用户登录数据库

    所用命令

    # mysql –uroot –pmairadb@root

    (3)创建数据库 zabbix 并设置数据库使用的字符集

    所用命令

    MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;

    (4)创建 zabbix 用户

    所用命令

    MariaDB [(none)]> CREATE USER zabbix@localhost IDENTIFIED BY ‘mariadb@zabbix’;

    (5)将 zabbix 数据库的权限赋予 zabbix 用户

    所用命令

    MariaDB [(none)]> GRANT all PRIVILEGES ON zabbix.* TO zabbix@localhost;

    (6)退出 mariadb

    所用命令

    MariaDB [(none)]> quit

    步骤 3:向 zabbix 数据库中导入初始架构和数据

    所用命令

    # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql –uzabbix –pmariadb

    zabbix

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 12页

    步骤 4:认识 Zabbix 中的各种配置文件

    (1)配置文件类型

    1)zabbix-server 配置文件:zabbix_server.conf

    2)zabbix-proxy 配置文件:zabbix_proxy.conf

    3)zabbix-agentd 配置文件:zabbix_agentd.conf

    只有按装了 zabbix-server 软件包,才会有 zabbix_server.conf 配置文件。同理,我们只安装

    了 zabbix-server 和 zabbix-agentd 软件包,所以只有 zabbix_server.conf 和 zabbix_agentd.conf 配

    置文件。

    (2)配置详解

    zabbix_server.conf

    # This is a configuration file for Zabbix server daemon

    # To get more information about Zabbix, visit http://www.zabbix.com

    ############ GENERAL PARAMETERS #################

    ### Option: ListenPort

    # Listen port for trapper.

    #

    # Mandatory: no

    # Range: 1024-32767 #默认侦听的端口取值范围

    # Default:

    # ListenPort=10051 #默认侦听的端口,默认即可

    ### Option: SourceIP

    # Source IP address for outgoing connections.

    #

    # Mandatory: no

    # Default:

    # SourceIP= #使用哪个出口 IP与外面通信,默认即可

    ### Option: LogType

    # Specifies where log messages are written to:

    # system - syslog

    # file - file specified with LogFile parameter

    # console - standard output

    #

    # Mandatory: no

    # Default:

    # LogType=file #设置记录日志的类型,默认记录至文件

    ### Option: LogFile

    # Log file name for LogType 'file' parameter.

    #

    # Mandatory: yes, if LogType is set to file, otherwise no

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 13页

    # Default:

    # LogFile= #指定 zabbix日志文件存放路径

    LogFile=/var/log/zabbix/zabbix_server.log

    ### Option: LogFileSize

    # Maximum size of log file in MB.

    # 0 - disable automatic log rotation.

    #

    # Mandatory: no

    # Range: 0-1024

    # Default:

    # LogFileSize=1 #指定日志文件大小及轮询相关,单位为 MB ,0表示禁用日志自动轮询,如果日志

    达到了限制,并且 rotation失败,老日志文件将会被清空掉,重新生成一个新日志。

    LogFileSize=0

    ### Option: DebugLevel

    # Specifies debug level:

    # 0 - basic information about starting and stopping of Zabbix processes

    # 1 - critical information

    # 2 - error information

    # 3 - warnings

    # 4 - for debugging (produces lots of information)

    # 5 - extended debugging (produces even more information)

    #

    # Mandatory: no

    # Range: 0-5

    # Default:

    # DebugLevel=3 #指定 debug调试信息级别,默认即可

    ### Option: PidFile

    # Name of PID file.

    #

    # Mandatory: no

    # Default:

    # PidFile=/tmp/zabbix_server.pid #定义 PID文件及路径

    PidFile=/var/run/zabbix/zabbix_server.pid

    ### Option: SocketDir

    # IPC socket directory.

    # Directory to store IPC sockets used by internal Zabbix services.

    #

    # Mandatory: no

    # Default:

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 14页

    # SocketDir=/tmp

    SocketDir=/var/run/zabbix

    ### Option: DBHost

    # Database host name.

    # If set to localhost, socket is used for MySQL.

    # If set to empty string, socket is used for PostgreSQL.

    #

    # Mandatory: no

    # Default:

    # DBHost=localhost #指定链接的数据库(默认为 localhost,zabbix与数据库安装在一台机器

    上,直接使用 localhost,这是通过 socket链接 mysql数据库的 IP地址)

    DBHost=localhost

    ### Option: DBName

    # Database name.

    #

    # Mandatory: yes

    # Default:

    # DBName= #链接数据库的名称

    DBName=zabbix

    ### Option: DBSchema

    # Schema name. Used for PostgreSQL.

    #

    # Mandatory: no

    # Default:

    # DBSchema= #指定链接其他类型数据库

    ### Option: DBUser

    # Database user.

    #

    # Mandatory: no

    # Default:

    # DBUser= #默认使用哪个用户链接数据库

    DBUser=zabbix

    ### Option: DBPassword

    # Database password.

    # Comment this line if no password is used.

    #

    # Mandatory: no

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 15页

    # Default:

    # DBPassword= #用户链接数据库的密码

    ### Option: DBSocket

    # Path to MySQL socket.

    #

    # Mandatory: no

    # Default:

    # DBSocket= #zabbix数据库运行后,产生的 socket文件及存放路径(主机为 localhost)

    ### Option: DBPort

    # Database port when not using local socket.

    #

    # Mandatory: no

    # Range: 1024-65535

    # Default:

    # DBPort= #数据库侦听的端口(默认 MySQL端口,socket链接默认即可)

    ### Option: HistoryStorageURL

    # History storage HTTP[S] URL.

    #

    # Mandatory: no

    # Default:

    # HistoryStorageURL=

    ### Option: HistoryStorageTypes

    # Comma separated list of value types to be sent to the history storage.

    #

    # Mandatory: no

    # Default:

    # HistoryStorageTypes=uint,dbl,str,log,text

    ### Option: HistoryStorageDateIndex

    # Enable preprocessing of history values in history storage to store values in

    different indices based on date.

    # 0 - disable

    # 1 - enable

    #

    # Mandatory: no

    # Default:

    # HistoryStorageDateIndex=0

    ### Option: ExportDir

    # Directory for real time export of events, history and trends in newline delimited

    JSON format.

    # If set, enables real time export.

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 16页

    #

    # Mandatory: no

    # Default:

    # ExportDir=

    ### Option: ExportFileSize

    # Maximum size per export file in bytes.

    # Only used for rotation if ExportDir is set.

    #

    # Mandatory: no

    # Range: 1M-1G

    # Default:

    # ExportFileSize=1G

    ############ ADVANCED PARAMETERS ################

    ### Option: StartPollers

    # Number of pre-forked instances of pollers.

    #

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartPollers=5 #初始化时,启动的子进程数量,数量越多,则服务端吞吐能力越强,对系

    统资源消耗越大

    ### Option: StartIPMIPollers

    # Number of pre-forked instances of IPMI pollers.

    # The IPMI manager process is automatically started when at least one IPMI

    poller is started.

    #

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartIPMIPollers=0 #IPMI技术用于获取硬件状态场景。若无相关监控项,建议设置为 0

    ### Option: StartPreprocessors

    # Number of pre-forked instances of preprocessing workers.

    # The preprocessing manager process is automatically started when

    preprocessor worker is started.

    #

    # Mandatory: no

    # Range: 1-1000

    # Default:

    # StartPreprocessors=3

    ### Option: StartPollersUnreachable

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 17页

    # Number of pre-forked instances of pollers for unreachable hosts (including IPMI

    and Java).

    # At least one poller for unreachable hosts must be running if regular, IPMI or Java

    pollers

    # are started.

    #

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartPollersUnreachable=1 #进程数量(主机不可达)

    ### Option: StartTrappers

    # Number of pre-forked instances of trappers.

    # Trappers accept incoming connections from Zabbix sender, active agents and

    active proxies.

    # At least one trapper process must be running to display server availability and

    view queue

    # in the frontend.

    #

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartTrappers=5 #用于设置诸如 SNMP STRAPPER场景提交来的数据的接收进程数,若客户

    机 SNMP TRAPPER技术较多,建议加大此参数值

    ### Option: StartPingers

    # Number of pre-forked instances of ICMP pingers.

    #

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartPingers=1 #用于设置启用 icmp协议 PING主机方式启动线程数量,若单台代理所管理

    机器超过 500台,建议加大此数值

    ### Option: StartDiscoverers

    # Number of pre-forked instances of discoverers.

    #

    # Mandatory: no

    # Range: 0-250

    # Default:

    # StartDiscoverers=1 #用于设置自动发现主机的线程数量,若单台代理所管理机器超过 500台,

    可以考虑加大此数值(仅适用于直接 AGENT场景),很占用带宽,不建议使用

    ### Option: StartHTTPPollers

    # Number of pre-forked instances of HTTP pollers.

    #

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 18页

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartHTTPPollers=1 #用于设置 WEB拨测监控线程数,可视具体情况增加或减少此数值

    ### Option: StartTimers

    # Number of pre-forked instances of timers.

    # Timers process maintenance periods.

    # Only the first timer process handles host maintenance updates. Problem

    suppression updates are shared

    # between all timers.

    #

    # Mandatory: no

    # Range: 1-1000

    # Default:

    # StartTimers=1 #pre-forked监控项计时器

    ### Option: StartEscalators

    # Number of pre-forked instances of escalators.

    #

    # Mandatory: no

    # Range: 0-100

    # Default:

    # StartEscalators=1

    ### Option: StartAlerters

    # Number of pre-forked instances of alerters.

    # Alerters send the notifications created by action operations.

    #

    # Mandatory: no

    # Range: 0-100

    # Default:

    # StartAlerters=3

    ### Option: JavaGateway

    # IP address (or hostname) of Zabbix Java gateway.

    # Only required if Java pollers are started.

    #

    # Mandatory: no

    # Default:

    # JavaGateway= #Zabbix Java gateway的主机名或者 ip地址,需要启动 Java pollers

    ### Option: JavaGatewayPort

    # Port that Zabbix Java gateway listens on.

    #

    # Mandatory: no

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 19页

    # Range: 1024-32767

    # Default:

    # JavaGatewayPort=10052 # Zabbix Java gateway监听端口

    ### Option: StartJavaPollers

    # Number of pre-forked instances of Java pollers.

    #

    # Mandatory: no

    # Range: 0-1000

    # Default:

    # StartJavaPollers=0 #进程数相关

    ### Option: StartVMwareCollectors

    # Number of pre-forked vmware collector instances.

    #

    # Mandatory: no

    # Range: 0-250

    # Default:

    # StartVMwareCollectors=0 # vmware的相关配置

    ### Option: VMwareFrequency

    # How often Zabbix will connect to VMware service to obtain a new data.

    #

    # Mandatory: no

    # Range: 10-86400

    # Default:

    # VMwareFrequency=60 #监控 vmware虚拟机频率

    ### Option: VMwarePerfFrequency

    # How often Zabbix will connect to VMware service to obtain performance data.

    #

    # Mandatory: no

    # Range: 10-86400

    # Default:

    # VMwarePerfFrequency=60

    ### Option: VMwareCacheSize

    # Size of VMware cache, in bytes.

    # Shared memory size for storing VMware data.

    # Only used if VMware collectors are started.

    #

    # Mandatory: no

    # Range: 256K-2G

    # Default:

    # VMwareCacheSize=8M

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 20页

    ### Option: VMwareTimeout

    # Specifies how many seconds vmware collector waits for response from VMware

    service.

    #

    # Mandatory: no

    # Range: 1-300

    # Default:

    # VMwareTimeout=10

    ### Option: SNMPTrapperFile

    # Temporary file used for passing data from SNMP trap daemon to the server.

    # Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file.

    #

    # Mandatory: no

    # Default:

    # SNMPTrapperFile=/tmp/zabbix_traps.tmp #指定 StartSNMPTrapper日志路径

    SNMPTrapperFile=/var/log/snmptrap/snmptrap.log

    ### Option: StartSNMPTrapper

    # If 1, SNMP trapper process is started.

    #

    # Mandatory: no

    # Range: 0-1

    # Default:

    # StartSNMPTrapper=0 #是否打开 StartSNMPTrapper功能,默认关闭

    ### Option: ListenIP

    # List of comma delimited IP addresses that the trapper should listen on.

    # Trapper will listen on all network interfaces if this parameter is missing.

    #

    # Mandatory: no

    # Default:

    # ListenIP=0.0.0.0 #监听来自 trapper的 ip地址(默认监听所有 ip地址)

    # ListenIP=127.0.0.1

    ### Option: HousekeepingFrequency

    # How often Zabbix will perform housekeeping procedure (in hours).

    # Housekeeping is removing outdated information from the database.

    # To prevent Housekeeper from being overloaded, no more than 4 times

    HousekeepingFrequency

    # hours of outdated information are deleted in one housekeeping cycle, for each

    item.

    # To lower load on server startup housekeeping is postponed for 30 minutes after

    server start.

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 21页

    # With HousekeepingFrequency=0 the housekeeper can be only executed using the

    runtime control option.

    # In this case the period of outdated information deleted in one housekeeping cycle

    is 4 times the

    # period since the last housekeeping cycle, but not less than 4 hours and not greater

    than 4 days.

    #

    # Mandatory: no

    # Range: 0-24

    # Default:

    # HousekeepingFrequency=1 #多少小时清理一次代理端数据库的 history, alert, and

    alarms,以保持代理端数据库轻便,建议保持默认

    ### Option: MaxHousekeeperDelete

    # The table "housekeeper" contains "tasks" for housekeeping procedure in the

    format:

    # [housekeeperid], [tablename], [field], [value].

    # No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename],

    [field], [value])

    # will be deleted per one task in one housekeeping cycle.

    # If set to 0 then no limit is used at all. In this case you must know what you are

    doing!

    #

    # Mandatory: no

    # Range: 0-1000000

    # Default:

    # MaxHousekeeperDelete=5000 #housekeeping 一 次 删 除 的 数 据 不 能 大 于

    MaxHousekeeperDelete

    ### Option: CacheSize

    # Size of configuration cache, in bytes.

    # Shared memory size for storing host, item and trigger data.

    #

    # Mandatory: no

    # Range: 128K-64G

    # Default:

    # CacheSize=8M # zabbix 初始化时占用多少系统共享内存用于存储配置信息,host,item,

    trigger数据,视监控主机数量和监控项调整,建议调整到 32M 或者更大

    ### Option: CacheUpdateFrequency

    # How often Zabbix will perform update of configuration cache, in seconds.

    #

    # Mandatory: no

    # Range: 1-3600

    # Default:

    # CacheUpdateFrequency=60 #设置多少秒更新一次配置缓存

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 22页

    ### Option: StartDBSyncers

    # Number of pre-forked instances of DB Syncers.

    #

    # Mandatory: no

    # Range: 1-100

    # Default:

    # StartDBSyncers=4 #将采集数据从 CACHE 同步到数据库线程数量,视数据库服务器 I/O 繁

    忙情况,和数据库写能力调整。数值越大,写能力越强。对数据库服务器 I/O 压力越大

    ### Option: HistoryCacheSize

    # Size of history cache, in bytes.

    # Shared memory size for storing history data.

    #

    # Mandatory: no

    # Range: 128K-2G

    # Default:

    # HistoryCacheSize=16M #历史记录缓存大小,用于存储历史记录,此数值越大,数据库读

    压力越小

    ### Option: HistoryIndexCacheSize

    # Size of history index cache, in bytes.

    # Shared memory size for indexing history cache.

    #

    # Mandatory: no

    # Range: 128K-2G

    # Default:

    # HistoryIndexCacheSize=4M

    ### Option: TrendCacheSize

    # Size of trend cache, in bytes.

    # Shared memory size for storing trends data.

    #

    # Mandatory: no

    # Range: 128K-2G

    # Default:

    # TrendCacheSize=4M #用于设置划分多少系统共享内存用于存储计算出来的趋势数据,此参

    数值从一定程度上可影响数据库读压力

    ### Option: ValueCacheSize

    # Size of history value cache, in bytes.

    # Shared memory size for caching item history data requests.

    # Setting to 0 disables value cache.

    #

    # Mandatory: no

    # Range: 0,128K-64G

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 23页

    # Default:

    # ValueCacheSize=8M #0表示禁用,设置 history value缓存大小,当缓存超标了,将会每隔

    5分钟往 server日志里面记录

    ### Option: Timeout

    # Specifies how long we wait for agent, SNMP device or external check (in seconds).

    #

    # Mandatory: no

    # Range: 1-30

    # Default:

    # Timeout=3 # agent,snmp,external check的超时时间,单位为秒,若采集数据不完整或网

    络繁忙,或从管理页面发现客户端状态变化频繁,可以考虑加大此数值

    Timeout=4

    ### Option: TrapperTimeout

    # Specifies how many seconds trapper may spend processing new data.

    #

    # Mandatory: no

    # Range: 1-300

    # Default:

    # TrapperTimeout=300 #处理 trapper数据的超时时间

    ### Option: UnreachablePeriod

    # After how many seconds of unreachability treat a host as unavailable.

    #

    # Mandatory: no

    # Range: 1-3600

    # Default:

    # UnreachablePeriod=45 #当检测到主机不可用时,设置多少秒将它设置为不可达

    ### Option: UnavailableDelay

    # How often host is checked for availability during the unavailability period, in

    seconds.

    #

    # Mandatory: no

    # Range: 1-3600

    # Default:

    # UnavailableDelay=60 #指定间隔时间多少秒检测主机是否不可用

    ### Option: UnreachableDelay

    # How often host is checked for availability during the unreachability period, in

    seconds.

    #

    # Mandatory: no

    # Range: 1-3600

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 24页

    # Default:

    # UnreachableDelay=15 #指定间隔时间多少秒检测主机是否不可达

    ### Option: AlertScriptsPath

    # Full path to location of custom alert scripts.

    # Default depends on compilation options.

    # To see the default path run command "zabbix_server --help".

    #

    # Mandatory: no

    # Default:

    # AlertScriptsPath=${datadir}/zabbix/alertscripts #指定告警脚本目录路径

    AlertScriptsPath=/usr/lib/zabbix/alertscripts

    ### Option: ExternalScripts

    # Full path to location of external scripts.

    # Default depends on compilation options.

    # To see the default path run command "zabbix_server --help".

    #

    # Mandatory: no

    # Default:

    # ExternalScripts=${datadir}/zabbix/externalscripts #自定义脚本存储路径

    ExternalScripts=/usr/lib/zabbix/externalscripts

    ### Option: FpingLocation

    # Location of fping.

    # Make sure that fping binary has root ownership and SUID flag set.

    #

    # Mandatory: no

    # Default:

    # FpingLocation=/usr/sbin/fping

    ### Option: Fping6Location

    # Location of fping6.

    # Make sure that fping6 binary has root ownership and SUID flag set.

    # Make empty if your fping utility is capable to process IPv6 addresses.

    #

    # Mandatory: no

    # Default:

    # Fping6Location=/usr/sbin/fping6

    ### Option: SSHKeyLocation

    # Location of public and private keys for SSH checks and actions.

    #

    # Mandatory: no

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 25页

    # Default:

    # SSHKeyLocation= #在服务端需要 SSH 到 AGENT 端且采用用 KEY 验证方式时使用

    ### Option: LogSlowQueries

    # How long a database query may take before being logged (in milliseconds).

    # Only works if DebugLevel set to 3, 4 or 5.

    # 0 - don't log slow queries.

    #

    # Mandatory: no

    # Range: 1-3600000

    # Default:

    # LogSlowQueries=0

    LogSlowQueries=3000

    ### Option: TmpDir

    # Temporary directory.

    #

    # Mandatory: no

    # Default:

    # TmpDir=/tmp # zabbix 服务端工作的临时目录

    ### Option: StartProxyPollers

    # Number of pre-forked instances of pollers for passive proxies.

    #

    # Mandatory: no

    # Range: 0-250

    # Default:

    # StartProxyPollers=1

    ### Option: ProxyConfigFrequency

    # How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds.

    # This parameter is used only for proxies in the passive mode.

    #

    # Mandatory: no

    # Range: 1-3600*24*7

    # Default:

    # ProxyConfigFrequency=3600

    ### Option: ProxyDataFrequency

    # How often Zabbix Server requests history data from a Zabbix Proxy in seconds.

    # This parameter is used only for proxies in the passive mode.

    #

    # Mandatory: no

    # Range: 1-3600

    # Default:

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 26页

    # ProxyDataFrequency=1

    … …

    zabbix_agentd.conf

    # This is a config file for the Zabbix agent daemon (Unix)

    # To get more information about Zabbix, visit http://www.zabbix.com

    ############ GENERAL PARAMETERS #################

    ### Option: PidFile

    # Name of PID file.

    #

    # Mandatory: no

    # Default:

    PidFile=/tmp/zabbix_agentd.pid #pid 文件的存放位置

    ### Option: LogFile

    # Name of log file.

    # If not set, syslog is used.

    #

    # Mandatory: no

    # Default:

    # LogFile=

    LogFile=/tmp/zabbix_agentd.log #日志文件的位置

    ### Option: LogFileSize

    # Maximum size of log file in MB.

    # 0 - disable automatic log rotation.

    #

    # Mandatory: no

    # Range: 0-1024

    # Default:

    LogFileSize=1024 #当日志文件达到多大时进行轮询操作

    ### Option: DebugLevel

    # Specifies debug level

    # 0 - no debug

    # 1 - critical information

    # 2 - error information

    # 3 - warnings

    # 4 - for debugging (produces lots of information)

    #

    # Mandatory: no

    # Range: 0-4

    # Default:

    DebugLevel=3 #日志信息(调试)级别

    ### Option: SourceIP

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 27页

    # Source IP address for outgoing connections.

    #

    # Mandatory: no

    # Default:

    # SourceIP= #连接的源 ip 地址,默认为空

    ### Option: EnableRemoteCommands

    # Whether remote commands from Zabbix server are allowed.

    # 0 - not allowed

    # 1 - allowed

    #

    # Mandatory: no

    # Default:

    # EnableRemoteCommands=0 #是否允许 zabbix server 端的远程指令, 0表示不允

    许, 1表示允许

    ### Option: LogRemoteCommands

    # Enable logging of executed shell commands as warnings.

    # 0 - disabled

    # 1 - enabled

    #

    # Mandatory: no

    # Default:

    # LogRemoteCommands=0 //是否开启日志记录 shell 命令作为警告 0表示不允许,1 表示允许

    ##### Passive checks related

    ### Option: Server

    # List of comma delimited IP addresses (or hostnames) of Zabbix servers.

    # Incoming connections will be accepted only from the hosts listed here.

    # No spaces allowed.

    # If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are

    treated equally.

    #

    # Mandatory: no

    # Default:

    # Server=

    Server=127.0.0.1 #zabbix server 的 ip 地址或主机名,可同时列出多个,需要用逗号隔开

    ### Option: ListenPort

    # Agent will listen on this port for connections from the server.

    #

    # Mandatory: no

    # Range: 1024-32767

    # Default:

    ListenPort=10050 #zabbix agent 监听的端口

    ### Option: ListenIP

    # List of comma delimited IP addresses that the agent should listen on.

    # First IP address is sent to Zabbix server if connecting to it to retrieve list of active

    checks.

    #

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 28页

    # Mandatory: no

    # Default:

    ListenIP=0.0.0.0 #zabbix agent 监听的 ip 地址

    ### Option: StartAgents

    # Number of pre-forked instances of zabbix_agentd that process passive checks.

    # If set to 0, disables passive checks and the agent will not listen on any TCP port.

    #

    # Mandatory: no

    # Range: 0-100

    # Default:

    StartAgents=3 #zabbix agent 开启进程数

    ##### Active checks related

    ### Option: ServerActive

    # List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for

    active checks.

    # If port is not specified, default port is used.

    # IPv6 addresses must be enclosed in square brackets if port for that host is

    specified.

    # If port is not specified, square brackets for IPv6 addresses are optional.

    # If this parameter is not specified, active checks are disabled.

    # Example:

    ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]

    #

    # Mandatory: no

    # Default:

    # ServerActive=

    ServerActive=127.0.0.1 #开启主动检查

    ### Option: Hostname

    # Unique, case sensitive hostname.

    # Required for active checks and must match hostname as configured on the server.

    # Value is acquired from HostnameItem if undefined.

    #

    # Mandatory: no

    # Default:

    # Hostname=

    Hostname=Zabbix server #在 zabbix server 前端配置时指定的主机名要相同,最重要

    的配置

    ### Option: HostnameItem

    # Item used for generating Hostname if it is undefined.

    # Ignored if Hostname is defined.

    #

    # Mandatory: no

    # Default:

    # HostnameItem=system.hostname

    ### Option: RefreshActiveChecks

    # How often list of active checks is refreshed, in seconds.

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 29页

    #

    # Mandatory: no

    # Range: 60-3600

    # Default:

    RefreshActiveChecks=120 #主动检查刷新的时间,单位为秒数

    ### Option: BufferSend

    # Do not keep data longer than N seconds in buffer.

    #

    # Mandatory: no

    # Range: 1-3600

    # Default:

    BufferSend=5 #数据缓冲的时间

    ### Option: BufferSize

    # Maximum number of values in a memory buffer. The agent will send

    # all collected data to Zabbix Server or Proxy if the buffer is full.

    #

    # Mandatory: no

    # Range: 2-65535

    # Default:

    BufferSize=100 #zabbix agent 数据缓冲区的大小,当达到该值便会发送所有的数据到 zabbix

    server

    ### Option: MaxLinesPerSecond

    # Maximum number of new lines the agent will send per second to Zabbix Server

    # or Proxy processing 'log' and 'logrt' active checks.

    # The provided value will be overridden by the parameter 'maxlines',

    # provided in 'log' or 'logrt' item keys.

    #

    # Mandatory: no

    # Range: 1-1000

    # Default:

    MaxLinesPerSecond=100 //zabbix agent 发送给 zabbix server 最大的数据行

    ### Option: AllowRoot

    # Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the

    agent

    # will try to switch to user 'zabbix' instead. Has no effect if started under a regular

    user.

    # 0 - do not allow

    # 1 - allow

    #

    # Mandatory: no

    # Default:

    AllowRoot=0 #是否允许 zabbix agent 以 root 用户运行

    ############ ADVANCED PARAMETERS #################

    ### Option: Alias

    # Sets an alias for parameter. It can be useful to substitute long and complex

    parameter name with a smaller and simpler one.

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 30页

    #

    # Mandatory: no

    # Range:

    # Default:

    ### Option: Timeout

    # Spend no more than Timeout seconds on processing

    #

    # Mandatory: no

    # Range: 1-30

    # Default:

    Timeout=3 #设定处理超时的时间

    ### Option: Include

    # You may include individual files or all files in a directory in the configuration file.

    # Installing Zabbix will create include directory in /usr/local/etc, unless modified

    during the compile time.

    #

    # Mandatory: no

    # Default:

    # Include=

    # Include=/usr/local/etc/zabbix_agentd.userparams.conf

    # Include=/usr/local/etc/zabbix_agentd.conf.d/ //包含子配置文件的路径

    ####### USER-DEFINED MONITORED PARAMETERS #######

    ### Option: UnsafeUserParameters

    # Allow all characters to be passed in arguments to user-defined parameters.

    # 0 - do not allow

    # 1 - allow

    #

    # Mandatory: no

    # Range: 0-1

    # Default:

    UnsafeUserParameters=0 #是否允许所有字符参数的传递

    ### Option: UserParameter

    # User-defined parameter to monitor. There can be several user-defined parameters.

    # Format: UserParameter=,

    # See 'zabbix_agentd' directory for examples.

    #

    # Mandatory: no

    # Default:

    UserParameter= #指定用户自定义参数

    步骤 5:修改 Zabbix Server 配置文件 zabbix_server.conf

    Zabbix Agentd 使用默认配置即可,Zabbix Server 也只需修改数据库密码即可。

    所用命令如下:

    # vi /etc/zabbix/zabbix_server.conf

    # 设置数据库密码:DBPassword=mariadb@zabbix

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 31页

    步骤 6:为 Zabbix 前端配置时区

    所用命令

    # vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

    # 设置时区:php_value[date.timezone] = Asia/Shanghai

    步骤 7:启动 Zabbix Server 和 Agent 进程

    所用命令

    # systemctl start zabbix-server zabbix-agnet rh-php72-php-fpm

    # systemctl enable zabbix-server zabbix-agent rh-php72-php-fpm

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 32页

    任务 5:配置 Zabbix 前端

    步骤 1:通过浏览器访问 Zabbix

    在本地实体机上,通过浏览器访问 Zabbix,URL 为:http://172.20.1.15/zabbix。

    步骤 2:配置数据库连接

    图 15-5-1通过浏览器访问 Zabbix

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 33页

    步骤 3:配置 Zabbix 服务器详细信息

    图 15-5-2配置数据库连接

    图 15-5-3配置 Zabbix服务器详细信息

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 34页

    步骤 4:安装

    步骤 5:登录

    Zabbix 默认用户/密码为:Admin/zabbix。

    图 15-5-4安装

    图 15-5-5登录

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 35页

    任务 6:添加监控,查看监控图形

    任务描述:

    以 Web方式登录 Zabbix系统,并添加宿主机的监控,查看监控图形。

    步骤 1:将 Zabbix 前端设置为中文

    登录 Zabbix 系统之后,点击左下角的【User settings】菜单,进入用户信息页面,在【Language】

    下拉菜单选择中文,如图 15-6-1 所示,最后点击【Update】按钮。

    更新之后自动跳转到【仪表板】,如图 15-6-2 所示。

    图 15-6-1设置中文

    图 15-6-2仪表板

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 36页

    步骤 2:添加主机群组

    (1)打开配置主机群组页面

    在【配置】菜单中,选择【主机群组】菜单项,打开配置主机页面。见图 11-5-3。

    (2)创建主机群组

    见图 15-6-3,点击右上角的【创建主机群组】按钮,创建主机群组【物理主机】,如图 15-6-4。

    步骤 2:添加宿主机

    在图 15-6-2 可以看到,Zabbix 已经监控了自身。

    图 15-6-3配置主机群组页面

    图 15-6-4创建主机群组

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 37页

    (1)打开配置主机页面

    在【配置】菜单中,选择【主机】菜单项,打开配置主机页面。见图 11-6-5,可以看到,Zabbix

    自身已经通过 Zabbix Agent 监控了起来。

    (2)进入创建主机页面

    见图 15-6-5,点击右上角【创建主机】按钮,进入创建主机页面,设置监控参数,见图 11-6-6。

    通过 SNMP 监控宿主机,将【客户端】Interfaces 移除。

    (3)选择链接模板,创建主机监控

    见图 15-6-6,点击上方的【模板】选项卡,选择链接的模板,创建主机监控,如图 15-6-7 所示。

    图 15-6-5配置主机页面

    图 15-6-6设置主机参数

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 38页

    步骤 3:查看监控图形

    (1)进入监测主机页面

    在【监测】菜单中,选择【主机】菜单项,打开监测主机页面。见图 15-6-9。

    图 15-6-7选择链接的模板

    图 15-6-8添加主机成功

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 39页

    (2)查看监控图形

    见图 15-6-9,点击主机条目中的图形,查看主机的监控图形,如图 15-6-10 所示。

    图 15-6-9监测主机页面

    图 15-6-10主机监控图形

  • 《网络运维管理》 / 实验十五:Zabbix监控系统的实现

    河南中医药大学信息技术学院 | 网络与信息系统科研工作室

    第 40页

    五、实验分析

    1、请简述 Zabbix 主机群组、主机和模板的关系。

    2、创建一个自定义的模板。