美文网首页
CentOS 7.3安装Zabbix 3.2

CentOS 7.3安装Zabbix 3.2

作者: 六月天的安静 | 来源:发表于2017-10-09 18:38 被阅读232次

    CentOS 7.3安装Zabbix 3.2

    一、准备搭建环境

    1.系统:CentOS 7.3

    2.软件:Zabbix 3.2

    主机 IP地址 系统
    Zabbix Server 10.10.1.113 CentOS 7.3
    Linux-Agent 10.10.10.114 CentOS 7.3

    二、安装前的准备

    最小化安装CentOS 7系统时,需要做一下设置:

    1.安装所需的软件包

    yum groupinstall "Development Tools"
    
    yum -y install vim lrzsz tree wget ntp mlocate
    
    ntpdate time.nist.gov   #与时间同步服务器同步
    

    2.关闭firewalld和iptables防火墙服务

    centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可:

    systemctl stop firewalld.service        #停止firewall
    systemctl disable firewalld.service     #禁止firewall开机启动
    firewall-cmd --state          #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
    
    

    如果你要改用iptables的话,需要安装iptables服务:

    yum install iptables-services
    systemctl enable iptables 
    systemctl enable ip6tables
    systemctl start iptables 
    systemctl start ip6tables
    

    3.关闭SElinux

    使用这个命令查看SElinux状态

    [root@localhost ~]# getenforce
    Enforcing
    
    [root@localhost ~]# vim /etc/selinux/config
    #在文件中找到这一行
    SELINUX=enforcing
    #把后面的参数修改为disabled
    SELinux=disabled
    
    
    • enforcing:开启防火墙
    • permissive:关闭防火墙,但是会产生相应的日志
    • disabled:彻底关闭防火墙,没日志产生

    不关机情况下关闭SElinux,这个在重启之后会失效,临时关闭

    [root@localhost ~]# setenforce 0
    

    三、安装Zabbix3.2

    1)安装LAMP环境

    yum -y install mariadb mariadb-server php php-mysql httpd
    
    #配置数据库开机启动
    systemctl enable mariadb
    systemctl start mariadb
    
    #配置Apache服务开机自启
    systemctl enable httpd
    systemctl start httpd
    
    

    2) 配置数据库

    • 查看MariaDB数据库在进程的状态
    [root@localhost ~]# ss -tulnp | grep mysqld
    tcp    LISTEN     0      50        *:3306     *:*   users:(("mysqld",pid=2674,fd=14))
    
    • 初始化mysql数据库,并配置root用户密码(默认为空密码)
    • mysql_secure_installation会执行以下几个设置:
    • a)为root用户设置密码
    • b)删除匿名账号
    • c)取消root用户远程登录
    • d)删除test库和对test库的访问权限
    • e)刷新授权表使修改生效
    [root@localhost ~]# mysql_secure_installation
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MariaDB to secure it, we'll need the current
    password for the root user.  If you've just installed MariaDB, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.
    
    Enter current password for root (enter for none): 
    OK, successfully used password, moving on...
    
    Setting the root password ensures that nobody can log into the MariaDB
    root user without the proper authorisation.
    
    Set root password? [Y/n] Y
    New password: 
    Re-enter new password: 
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
    
    
    By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.
    
    Remove anonymous users? [Y/n] Y
     ... Success!
    
    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? [Y/n] Y
     ... Success!
    
    By default, MariaDB comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.
    
    Remove test database and access to it? [Y/n] Y
     - Dropping test database...
     ... Success!
     - Removing privileges on test database...
     ... Success!
    
    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    
    Reload privilege tables now? [Y/n] Y
     ... Success!
    
    Cleaning up...
    
    All done!  If you've completed all of the above steps, your MariaDB
    installation should now be secure.
    
    Thanks for using MariaDB!
    
    
    • 创建zabbix数据库及访问用户
    mysql -uroot -proot -e "create database zabbix default character set utf8 collate utf8_bin;"
    
    mysql -uroot -proot -e "grant all on zabbix.* to 'zabbix'@'%' identified by 'zabbix';"
    
    
    • 测试刚创建的数据库及用户
    mysql -uzabbix -pzabbix
    
    show databases;
    
    exit;
    

    3)安装Zabbix Server端

    • 导入yum源
    rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
    
    • 安装Zabbix
    yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
    
    • 导入zabbix数据结构
    [root@localhost ~]# updatedb             #生成查找快照
    [root@localhost ~]# locate create.sql    #查找create.sql文件位置
    /usr/share/doc/zabbix-server-mysql-3.2.7/create.sql.gz
    [root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.7
    [root@localhost zabbix-server-mysql-3.2.7]# zcat create.sql.gz | mysql -uroot -proot zabbix
    
    
    • 修改Zabbix Server配置文件
    [root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
    
    新增如下内容:
    
    DBHost=localhost
    
    DBName=zabbix
    
    DBUser=zabbix
    
    DBPassword=zabbix
    
    • 修改Zabbix的php配置文件
    vim /etc/httpd/conf.d/zabbix.conf
    
    取消内容为:php_value date.timezone的注释,并调整值为:Asia/Shanghai
    
    • 启动Zabbix-Server,设置为开机自启动
    [root@localhost ~]# systemctl enable zabbix-server
    [root@localhost ~]# systemctl start zabbix-server
    [root@localhost ~]# systemctl enable zabbix-agent
    [root@localhost ~]# systemctl start zabbix-agent
    
    
    • 重启Apache服务器
    [root@localhost ~]# systemctl restart httpd
    
    • 浏览器访问Zabbix-Server,进一步安装Zabbix

    • 使用http://IP/zabbix访问

    • 检查组件是否所有ok,直接下一步
    • 创建数据库的连接:输入端口号和密码
    • 完成安装
    • 默认登录账户密码:Admin/zabbix
    • 设置语言为中文:Chinese(zh_CN
    • 简单设置一下,启用Zabbix Server的监控

    解决乱码问题

    解决办法如下:
    在Windows系统下Win+R打开运行,输入fonts,回车进入Windows字体目录,找到黑体-常规,复制出来将文件名修改为simhei.ttf,然后上传到/usr/share/zabbix/fonts
    [root@localhost  ~]# cd /usr/share/zabbix/fonts
    [root@localhost fonts]# rz     #上传simheil.ttf字体
    [root@localhost fonts]# ls
    graphfont.ttf  simhei.ttf
    
    

    上传成功后,编辑 /usr/share/zabbix/include/defines.inc.php这个文件

    大约在45行,将'graphfont' 修改为simhei 。

    [root@localhost fonts]# vim /usr/share/zabbix/include/defines.inc.php
     44 define('ZBX_FONTPATH',                          realpath('fonts')); // where to search for font (GD > 2.0.18)
     45 define('ZBX_GRAPH_FONT_NAME',           'simhei'); // font file name
     46 define('ZBX_GRAPH_LEGEND_HEIGHT',    120); // when graph height is less then this value, some legend will not show up
    
    

    修改完成后,刷新乱码就好了。

    四、安装Zabbix-agent

    1.监控Linux系统配置

    客户端CentOS 7.3系统
    (1). 导入yum源

    rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
    

    (2). 安装zabbix-agent

    yum -y install zabbix-agent
    

    (3). 配置zabbix-agent

    vim /etc/zabbix/zabbix_agentd.conf
    
    Server=10.10.10.113
    ServerActive=10.10.10.113
    Hostname=10.10.10.114
    
    • 修改Server的IP,地址为服务端地址:Server=ServerIP
    • 修改ServerAcive的IP,地址为服务端地址:ServerActive=ServerIP
    • Hostname修改为网页里面添加的Hostname,需要保持一致,zabbix_agentd客户端计算机名:Hostname=Zabbix server
    • 设置为0 仅为主动模式,如果需要发送数据等 可以不修改此项:StartAgents=0

    (4). 启动zabbix-agent,并配置开机启动

    systemctl enable zabbix-agent
    systemctl start zabbix-agent
    

    服务端配置监控Linux主机

    配置 --> 主机 --> 创建主机


    创建主机后,选择主机选项,然后填写:主机名称、可见的名称、群组、agent代理程序的接口IP,这几项添写就OK了

    然后再添加模板


    然后勾选刚刚添加的主机,点击"启用"

    从拓扑图里右键可以查看主机聚合图形,具体查看Linux主机监控指标的图表


    添加网络拓扑图 --> 更新


    2.监控Windows系统配置
    (1). 下载文件: http://www.zabbix.com/downloads/3.2.0/zabbix_agents_3.2.0.win.zip

    (2). 解压到C盘根目录,再修改文件:zabbix_agents_3.2.0.win/conf/zabbix_agentd.win.conf

    Server=10.10.10.113
    ServerActive=10.10.10.113
    Hostname=Windows Server
    
    

    (3).修改完后,"Win+R"打开cmd命令行运行安装Zabbix Agent服务注册,启动一下

    # 安装注册服务
    c:\zabbix_agents_3.2.0.win\bin\win64\zabbix_agentd.exe -i  -c c:\zabbix_agents_3.2.0.win\conf\zabbix_agentd.win.conf
    # 删除注册服务
    c:\zabbix_agents_3.2.0.win\bin\win64\zabbix_agentd.exe  -d  -c  c:\zabbix_agents_3.2.0.win\bin\win64\zabbix_agentd.win.conf
    
    

    (4).在服务端"配置" --> "主机" --> "创建主机"

    最后再"配置" --> "主机"里勾选"[Windows Server测试主机]"启用,一会就可以看到图形

    从拓扑图里右键可以查看主机聚合图形,具体查看Windows主机监控指标的图表


    添加网络拓扑图 --> 更新

    五、安装图形展示

    1.趋势图集中显示Graphtree插件

    插件地址:https://github.com/OneOaaS/graphtrees

    (1).在Server上配置,下载补丁并升级

    cd /usr/share/zabbix
    wget https://raw.githubusercontent.com/OneOaaS/graphtrees/master/graphtree3.0.4.patch
    yum install -y patch        #安装打补丁path包,安装过可忽略
    patch  -Np0 <graphtree3.0.4.patch
    chown -R apache:apache oneoaas/    #设置权限,注意此处的权限,必须和nginx或者apache的用户一致
    
    

    (2).安装好后,会在主页显示Graphtree插件


    (3).删除广告信息
    vim /usr/share/zabbix/oneoaas/templates/graphtree/graphtree.tpl
    删除顶部图片8-12行和66-86底部广告

    66 <footer id="footer" class="footer navbar-inverse">
     61     <div class="container">
     62         <ul>
     63             <li class="qrcode">
     64                 ![](../oneoaas/assets/img/qrcode.jpg)
     65                 <p>专业 合作 开放 </p>
     66                 <p>运维方案解决专家</p>
     67             </li>
     68             <li class="business">
     69                 <p>Zabbix监控项目承接</p>
     70                 <p>运维解决方案咨询</p>
     71                 <p>运维产品咨询</p>
     72                 <p><a href="[http://www.oneoaas.com](http://www.oneoaas.com/)">[www.oneoaas.com](http://www.oneoaas.com/)</a></p>
     73                 <p>请联系 support#[oneoaas.com](http://oneoaas.com/) (#替换为@)
     74             </li>
           ……………
    
    86 </footer>
    

    (4).重新载入Zabbix-web,可以看到Graphtree已出效果;

    systemctl restart httpd
    

    2.安装Grafana 4实现可视化图形监控

    Grafana 是 Graphite 和 InfluxDB 仪表盘和图形编辑器。Grafana 是开源的,功能齐全的度量仪表盘和图形编辑器,支持 Graphite,InfluxDB 和 OpenTSDB。

    Grafana 主要特性:灵活丰富的图形化选项;可以混合多种风格;支持白天和夜间模式;

    多个数据源;Graphite 和 InfluxDB 查询编辑器等等。

    官网:https://grafana.com/

    安装Grafana

    (1).安装服务端图形呈现依赖包

    yum install fontconfig
    yum install freetype*
    yum install urw-fonts
    yum install initscripts
    

    (2). 在服务端安装Grafana 4.4.3

    #使用yum源安装
    yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.4.3-1.x86_64.rpm
    #使用rpm安装
    wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.4.3-1.x86_64.rpm
    rpm -Uvh grafana-4.4.3-1.x86_64.rpm
    
    

    (4).启动Grafana并设置开机启动

    systemctl daemon-reload                #重新载入服务
    systemctl start grafana-server 
    systemctl status grafana-server
    systemctl enable grafana-server.service
    
    

    (5).查看安装包位置

    [root@localhost ~]# rpm -qc grafana
    /etc/init.d/grafana-server
    /etc/sysconfig/grafana-server
    /usr/lib/systemd/system/grafana-server.service
    

    (6). 访问Grafana

    地址:http://ServerIP:3000

    默认登录用户名密码:admin/admin

    为Grafana安装Zabbix插件

    (1). grafana-zabbix插件安装有好几种方式:

    # 第一种:使用grafana-cli工具安装
    
    获取可用插件列表命令
    grafana-cli plugins list-remote
    安装zabbix插件命令
    grafana-cli plugins install alexanderzobnin-zabbix-app
    
    安装插件完成之后重启garfana服务
    systemctl restart grafana-server
    service grafana-server restart
    
    # 第二种:使用grafana-zabbix-app源,其中包含最新版本的插件
    
    cd /var/lib/grafana/plugins/
    克隆grafana-zabbix-app插件项目
    git clone https://github.com/alexanderzobnin/grafana-zabbix-app
    
    注:如果没有git,请先安装git
     yum –y install git
    
    插件安装完成重启garfana服务
    systemctl restart grafana-server
     service grafana-server restart
    
    注:通过这种方式,可以很容易升级插件
    $ cd /var/lib/grafana/plugins/grafana-zabbix-app
    $ git pull
    $ service grafana-server restart
    
    # 第三种:使用源码包安装(一般没有必要)
    需要安装NodeJS, npm和Grunt 从源码构建插件,更多安装方法可以查看Grafana docs.
    git clone https://github.com/alexanderzobnin/grafana-zabbix.git
    cd grafana-zabbix
    npm install
    npm install -g grunt-cli
    grunt  #插件将建成dist/目录。然后你可以将它复制到你的grafana插件目录或在grafana配置文件中指定编译插件的路径
    如果需要更新,执行下面命令
    git pull
    Grunt
    重启grafana服务
    systemctl restart grafana-server
    service grafana-server restart
    

    这里使用grafana-cli工具安装的

    # 安装grafana-zabbix插件:
    [root@localhost plugins]# grafana-cli plugins install alexanderzobnin-zabbix-app
    
    # 以下插件可以根据自己所需安装
    # 安装grafana-clock-panel钟表形展示
    [root@localhost plugins]# grafana-cli plugins install grafana-clock-panel
    
    #安装briangann-gauge-panel字符型展示
    [root@localhost plugins]# grafana-cli plugins install briangann-gauge-panel
    
    #安装natel-discrete-panel服务器状态
    [root@localhost plugins]# grafana-cli plugins install natel-discrete-panel
    
    #安装grafana-worldmap-panel世界地图插件
    grafana-cli plugins install grafana-worldmap-panel 
    
    [root@localhost plugins]# systemctl restart grafana-server
    
    

    (2).到网站管理控制台启用zabbix插件

    移动到grafana左侧面板的插件,选择应用程序选项卡,然后选择"Apps"选项卡,打开Zabbix,启用插件


    (3).添加Zabbix为数据源

    点击左侧的"Data Sources" --> "Add data source"

    默认的接口地址: http://ip/zabbix3/api_jsonrpc.php

    • Name 可以自定义

    • Type下拉框中选择Zabbix

    • Http setting s --> Url 填入http://zabbix-server-ip/zabbix/api_jsonrpc.php 这里填入的是Zabbix API接口

    • Http settings --> Access 选择 direct 使用直接访问的方式

    • Zabbix API details --> User 填入Admin

    • Zabbix API details --> Password 填入 zabbix

    • 点击"Sava & Test"保存并测试,测试API配置是否正确。配置成功会出现:Success Zabbix API version: 3.2.7

    自定义仪表板

    1.Grafana仪表板配置

    配置完Zabbix Source,需要自定义仪表板显示所需的监控项图形,配置仪表板的步骤如下:

    • 点击左侧的"Dashboards" --> 在下拉菜单的底部选择"+ New"。这时新的页面中默认出现一个空的横行图表,左上角有的隐藏的按钮,鼠标放上可以看到,右下角有"+ ADD ROW"

    • 添加"Graph"面板,鼠标往下拖,就可以添加一个面板;列出的面板包括"Graph、Singlestat、Table、Text、Heatmap、Alert List、Dashboard list、Clock……"

    • 如需再添加面板,鼠标放在左上角处,选择Add Panel,和上一步一样;

    • 最后一步点击"保存"或者使用快捷键"Ctrl+s",设置仪表板的名称,保存下来;


    新添加一个"Graph"面板


    这里介绍以下主要面板:

    官网介绍:http://docs.grafana.org/features/panels/

    (1).Graph

    这个选项是创建一个图表,类似于Zabbix的监控图表,是最常用的类型之一。

    • General-Title:设置该图表的名称

    • Metrics:在该项的右下角,选择正确的数据源(之前在Data Sources配置的Name)

    • Metrics-Group/Host/Application/Item:这些项目是必填项目,需要依次下拉选择*如果一张图需要展现两条线的数据,可以在左下角点击"+ Query"

    • Display Styles-Chart Options:这里可以选择以竖线展示,以折线展示或以点来展示数据

    (2).Table

    表格展示,类似于Excel表格的展现形式

    • 点击"- +"号可以调整该模块的大小(横向伸缩)

    • 点击"Edit"可以重新编辑该模块的数据源

    (3).Singlestat

    单统计模块,从字面意思就可以知道,该种模块仅可以展示一种数据,统计一种数据。这里需要重点说明就是Option
    选项下的参数以统计磁盘使用大小一项来举例

    • Unit:要选择data下的bytes单位来统计

    • Decimals:小数设置保持默认的auto即可

    • Coloring:这里可以选择渲染背景色或字体色

      • Colors控制着三个颜色,可以自由发挥,一般绿色代表正常,黄色代表预警,红色代表警告

      • Thresholds可以设置以逗号分隔的三个数字,分别表示三个状态的阈值

      • Spark lines有两种显示模式,Show会在数据的下方展示折线;Background mode会在整个模块的背景展示折线

    (4).Text

    这个模块很好理解,就是一个现实文字的模块,支持markdown语法,可以放在每个页面的头部,标记当前图表信息的归类。

    (5).Dashboards list

    这个模块是用来展示页面列表用的。举个例子,如果一个监控系统中,涉及到了多个页面展示监控图表,就会用到这个功能,这个模块会列出你需要展示的页面的列表,方便在当前页面中,快速的切换到其他监控页面。

    2.配置Graph Panel

    现在开始配置刚刚添加好的"Graph"面板


    修改标题

    • 设置数据源

    • 设置主机组 Zabbix servers

    • 设置主机到Zabbix server 。

    • 设置应用程序到CPU

    • 设置项为Processor load (1 min average per core)

    然后再回到"Metrics",多添加几个查询,比如我添加5分钟、15分钟的负载


    再添加另一个图表,可以重复上述步骤或复制现有图形。

    要复制现有的图,选择面板标题,然后单击duplicate 。 然后选择新的图形的标题,并选择Edit选项。然后应用以下设置:

    • 更改标题为CPU usage
    • 选择指标选项卡和项目字段更改为/CPU.*/
      可以对主机或度量名称使用正则表达式模式。只是一定要在包含正斜杠(模式/ )

    使用快键键"ESC"退出到主面板,然后"Ctrl+s"保存一下,一会可以看到图形;


    如需添加其他图表的应用程序展示,可以按照这种方法来配置,大同小异;

    3.配置Singlestat Panel

    点击左下角"+ ADD ROW "新添加一行,选择"Singlestat"向下拖;

    • 设置 General 选项:
      • 设置标题字段为:Free disk space on /
      • 其他无需设置
    • 设置Metrics选项如下:

    • 面板数据源设置 Zabbix Server

    • 主机组设置 Zabbix servers

    • 主机设置 Zabbix server

    • 应用程序设置 Filesystems

    • 项目设置为Free disk space on / (percentage)

    • 设置Options选项如下:

    • 设置Valuet的stat为"current"

    • 设置单元为百分比

    • 设置Coloring的值,勾选上和阈值设置为10,20 在测量仪上显示这些阈值

    • 设置Gauge(测量)启用Show选项,勾选阈值便签和标记


    Esc返回到仪表板,调整到最上面,然后"Ctrl+s"保存,展示数据如下:


    例:测试实时响应情况,我们将手动减少磁盘上的可用空间,并查看仪表板显示的内容。
    首先登陆到Linux Agent服务器,查看"/"目录的使用情况
    [root@localhost ~]# df -hT
    Filesystem          Type      Size  Used Avail Use% Mounted on
    /dev/mapper/cl-root xfs        17G  1.7G   16G  10% /
    devtmpfs            devtmpfs  1.9G     0  1.9G   0% /dev
    tmpfs               tmpfs     1.9G     0  1.9G   0% /dev/shm
    tmpfs               tmpfs     1.9G  8.5M  1.9G   1% /run
    tmpfs               tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
    /dev/sda1           xfs      1014M  138M  877M  14% /boot
    tmpfs               tmpfs     380M     0  380M   0% /run/user/0
    
    

    通过查看,有16 GB的可用空间,然后减少对根分区的20%阈值之下,使用fallocate命令创建一个大的临时文件:

    [root@localhost ~]# fallocate -l 15G /tmp/test.img    #可以根据服务器上的可用空间量设置文件大小
    

    最后,让我们在仪表板上显示活动的Zabbix触发器,这里我们引入一个"Zabbix Triggers"面板。

    4.配置Zabbix Triggers

    设置 General 选项:
    设置标题字段为:Zabbix Alarm
    其他无需设置

    • 设置Options选项:
    • show fileds 勾选显示详细的属性

    Esc返回到仪表板,调整到最上面,然后"Ctrl+s"保存,可以看到主动触发器通知您服务器上缺少可用空间显示的报警:


    最好删除之前创建的临时文件以释放磁盘上的空间,消除告警信息:

    [root@localhost ~]# rm -rf /tmp/test.img 
    

    再次查看,已没有告警信息显示了


    其他面板可以通过上面的方式自行添加,就不一一介绍了,来一张编辑好的图形,是不是很漂亮:

    Grafana-zabbix模板配置

    在配置好自定义的仪表板时,展示的效果还是很不错的,但是有一个缺点,每次只能查看一台主机的监控图形,如果有多台很是不方便,所以这时可以引入模板设置,通过变量的方式去实现,根据选择显示不同主机的状态,比较灵活;需要的设置的变量包括:group、host、application、item 下面介绍下模板的各种参数;

    模板

    仪表盘模板可以让你创建一个交互式和动态性的仪表板,它是Grafana里面最强大的、最常用的功能之一。创建的仪表盘模板参数,可以在任何一个仪表盘中使用。

    创建变量

    点击顶部的设置按钮,选择模板," + New" 创建新的变量,可以看到模板变量编辑器,包含以下参数:

    变量(Variable)

    命名:变量的名称。
    标签:可见标签变量
    类型:查询类型选择; 有6种变量类型: query,custom,interval,Data source和Contsta,Ad hoc filters它们都可以用来创建动态变量,不同之处在于获得的数据值不一样

    查询选项(Query Options)
    数据源:用于查询变量值的数据源
    刷新:更新此变量的值
    查询:查询字符串。
    正则表达式:如果你需要筛选值或提取值的一部分,那就使用正则表达式

    其中query的匹配原则
    
       *                           returns all groups
       *.*                        returns all hosts (from all groups)
       Servers.*             returns all hosts in group Servers
       Servers.*.*           returns all applications in group Servers
       Servers.*.*.*        returns all items from hosts in group Servers
    
    

    选择选项(Selection Options)
    多值:启用,如果你想在同一时间选择多个值

    数值组/标签(实验功能)(Value groups/tags (Experimental feature))

    开始创建模板

    复制一个面板出来,免得出错,创建模板

    依次添加host、application、item变量

    模板适合监控单独一项,不能同时选择多个item,可以选择多台主机显示在一个监控图形中,形成对比;仪表板上的每个面板都可以显示不同服务器的数据,您可以使用Grafana以许多有用的方式过滤数据,Grafana很强大,还有很多功能要自己摸索;

    页面自动刷新

    点击右上角Last 30 minutes, 在弹出的下拉框中,选择Time range下的Refreshing every选项,点击下拉框按钮,有off 和其他选项。点击5s然后Apply设置。即为每5秒刷新一次数据的意思。设置成功后,在原来Last 30 minutes的后面会出现Refresh every 5s的橙色文字!

    总结

    在本教程中,使用yum安装Zabbix 3.2;以及使用Zabbix监控Linux系统主机和Windows系统主机;安装图形插件Graphtree;由于图形显示不够好看,学习了如何安装和配置Grafana,创建自定义仪表板、不同插件配置、显示Zabbix数据的面板。可以在桌面或大屏幕上显示这些仪表板,以便管理员可以查看IT基础架构的状态,配置模板等。后续再慢慢补充Zabbix相关配置,欢迎大家批评指正;

    相关文章

      网友评论

          本文标题:CentOS 7.3安装Zabbix 3.2

          本文链接:https://www.haomeiwen.com/subject/rdvpyxtx.html