Search code examples
zabbix

Zabbix external checks


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.


Solution

  • 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]