Using zabbix calculated items within template

zabbix

I have a Zabbix monitoring template, which defines a number of items, plus an additional calculated item.

The template is T extern.

This defines some active checks using an external script, that run every 10min, return a single integer, and have the name formats:

T extern:script.pl["{HOST.IP}","foo"]
T extern:script.pl["{HOST.IP}","foo"]

So far, this all works, the checks run correctly, and data is updated.

Now I try and define a calculate field in the template called T extern:summary, updating every 5min, with the formula:

( last("T extern:script.pl[\"{HOST.IP}\",\"foo\"]") + last("T 
extern:script.pl[\"{HOST.IP}\",\"bar\"]") ) / 2

However, this fails to work and the item always has an unknown value.

What am I doing wrong in the configuration?

Best Answer

The problem was that, when defining a calculated field in a template, you do not include the template name (though you do include it if you're defining a trigger). So, the correct formula was:

( last("script.pl[\"{HOST.IP}\",\"foo\"]")
    + last("script.pl[\"{HOST.IP}\",\"bar\"]")
) / 2