(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到此结束

 

转载于:https://www.cnblogs.com/wyzhou/p/10839223.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值