Zabbix external checks

2019-09-14 17:00发布

问题:

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?

Example:

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

As each one of the above would be an item.

回答1:

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

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