zoukankan      html  css  js  c++  java
  • (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到此结束

  • 相关阅读:
    三款主流静态源代码安全检测工具比较
    原生JS封装ajax以及request
    vue生命周期
    微信 jssdk 逻辑在 vue 中的运用
    JS数组中的indexOf方法
    React和Vue中,是如何监听变量变化的
    Vue2学习小记-给Vue2路由导航钩子和axios拦截器做个封装
    VUE使用中踩过的坑
    Vue系列(一):简介、起步、常用指令、事件和属性、模板、过滤器
    Vue系列(二):发送Ajax、JSONP请求、Vue生命周期及实例属性和方法、自定义指令与过渡
  • 原文地址:https://www.cnblogs.com/wyzhou/p/10839223.html
Copyright © 2011-2022 走看看