• (63)zabbix low-level discover zabbix批量部署必备


    1. 概述

    • 《zabbix发现配置》server通过配置好的规则,自动添加host、group、template
    • 《zabbix Active agent自动注册》与discovery相反,功能基本相同,active联系server,server自动添加host、group、template

    以上目的都是发现host、添加host

    本文的low-level discovery更底层点,用于发现item、trigger、graph等等。我们最常用如:filesystem(如/、/home、/proc、C:、D:等),network(eth0,eth1等)

    2. Discovery之文件系统

    众多服务器,难免系统以及分区会有所不同。一般存在linux和windows两种系统,linux下分区有/、/data、/proc等等,windows有C:D:E:等,A服务器有/data分区,B服务器可能有/site分区。他有什么分区,我便监控什么分区,这就是low-level discovery的功能。

    2.1 创建模板

    创建模板A_Template_For_Discovery,.....过程省略....

    2.2 配置discovery规则

    configuration>>templates>>找到模板“A_Template_For_Discovery”>>Discovery(0)>>Create discovery rule

    属性说明:

    Keep lost resources period(in days):数据保留天数,默认30天

    Fileter:

    Macro为{#FSNAME},key “vfs.fs.discovery”返回json数据列表,里面内容为{#FSNAME}作为key,/、/data、C:等等作为value。

    regext可以使用表达式,例如"^/data|/C:"

    如果想通过{#FSTYPE}来过滤,那么Macro写{#FSTYPE},regexp写^(ext2|ext3|swap)$,或者引入zabbix中定义好的的正则表达式,@表达式名称

    2.3 创建Item prototypes

    其实就是一个创建一个item,configuration>>templates>>找到模板“A_Template_For_Discovery”>>Discovery(1)>>find file system>>Item prototypes (0)>>create Item prototypes

    2.4 创建Trigger

    当剩余量小于20%触发warnning

    configuration>>templates>>找到模板“A_Template_For_Discovery”>>Discovery(1)>>find file system>>Trigger prototypes (0)>>Create trigger prototypes

     

    与普通的trigger区别在{#FSNAME}

    2.4 创建graph

    绘制简单图表

    configuration>>templates>>找到模板“A_Template_For_Discovery”>>Discovery(1)>>find file system>>Graph prototypes (0)>>Create Graph prototypes

     

    3. 自定义LLD规则

    系统已经内建了文件系统的{#FSNAME},网络的{#IFNAME},因为业务的特殊性,我们如何定义我们自己需要的名称呢?

    • 编写脚本,脚本输出json数据,包含key和value
    • 脚本加入zabbix_agentd.conf UserParameter
    • 重启zabbix_agentd
    • 使用定义好的名称配置low-level discovery

    3.1 脚本范例

    3.2 结果范例

    执行后得到如下数据,是json格式

    zabbix discovery到此结束

  • 相关阅读:
    7.13dfs例题:部分和
    7.12dfs例题:数独游戏
    1.2题解:如何找数组中唯一成对的那个数(位运算)
    左程云Java算法(1)
    SQL基本语句增删改查
    Python spyder Ipython console 连接失败问题
    VBA——Msgbox
    python 字符串
    Scrapy-selectors总结
    文字单行居中,多行居左/居右
  • 原文地址:https://www.cnblogs.com/wyzhou/p/10839223.html
Copyright © 2020-2023  润新知