Zabbix 外部检查 [英] Zabbix external checks

查看:45
本文介绍了Zabbix 外部检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行一个返回我的外部检查:OK 1 2 0 8(这个值会改变每次检查)

I am executing an external check which returns me: OK 1 2 0 8 (This values will change every check)

有谁知道如何将这些值分成项目?

Does anyone knows how can I separate this values into items?

示例:

External check status: OK
In use: 1
Busy: 2
Problem: 0
Free: 8

因为上面的每一个都是一个项目.

As each one of the above would be an item.

推荐答案

遗憾的是,目前无法使用适用于所有项目类型的标准 Zabbix 方法将接收到的字符串值分解为多个部分.

Unfortunately, it is currently not possible to destructure a received string value into parts using standard Zabbix means for all item types.

但是,像 vfs.file.regexp[] 这样的项目支持应用正则表达式并捕获其输出(请参阅 文档 了解详情).在这种情况下,您可以将脚本的输出写入一个文件,然后创建五个项目,大致如下所示:

However, some items like vfs.file.regexp[] support applying a regular expression and capturing its output (see documentation for details). In this case, you could write the output of your script into a file and then create five items, approximately as follows:

vfs.file.regexp[/tmp/file.txt,^(\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ \w+ (\w+),,,,\1]

这篇关于Zabbix 外部检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆