Search code examples
triggerszabbix

Aggregate item data from Zabbix?


I would like to have Zabbix monitor different items (on the same host, or on different hosts) and assign a value depending on the outcome, then have it fire (or not) a trigger depending on the aggregation of these values.

For instance, let's imagine a cluster of 3 database nodes. Zabbix monitors every one of them via ping and increases a global variable by 1 if the node is reachable. After a round, the variable could have the following values:

  • 3 => (all nodes are up) cluster is OK
  • 2 => (one node is down) cluster is still working but in degraded state
  • 1 => (two nodes are down) cluster is working but no replication is done
  • 0 => (all nodes are down) cluster is down

Then Zabbix fires a trigger with WARNING severity if value is 1, and a trigger with HIGH severity if value is 0.

Is there a way to do this natively or via a module, without having to use the APIs? Thanks.


Solution

  • In order to aggregate data from several items into one, you can either use aggregate items or calculated items. Aggregate items allow to aggregate all items with the same key in the specified host groups, whereas calculated items allow arbitrary operations on items based on a formula.

    In order to have two triggers with different severities, you may find trigger dependencies useful. Here, a trigger with a lower dependency would depend on a trigger with a higher dependency.