Search code examples
monitoringzabbix

Creating Zabbix trigger with item from different template


I have an item in Template A and would like to have a trigger for only a subset of hosts that have the Template A configured for them.

I would not like to create the trigger on Template A and manually disable it for the hosts I don't need it for (I have too many hosts, might need additional triggers, might need to fine-tune (that re-enables them)), so I created Template B and assigned to the hosts I'd like to have the new trigger.

I tried to...

  • create a trigger with expression {Template B:item}>value, but Zabbix complained that Template B has no such item (which is true if only considering this template but Template A is also assigned to all hosts). And I cannot create the item in Template B as it conflicts with the other.

  • create a trigger on Template B and reference the item in Template A, but the trigger moved to Template A and got applied to all hosts.

  • create a macro for Template B, assigned it to the hosts I need, and added a new trigger to Template A with expression {$MACRO_NAME}=1 and {Template A:item}>limit.

What is the proper solution for this case?

(If it matters, the server and hosts are running Zabbix version 3.2.1 and Debian Linux.)


Solution

  • You can use Macro. define a macro in your template and change value of this according of host.

    you can change value of macro with zabbix api.