Search code examples
zabbix

How to Display one variable and one constant value in zabbix trigger


I would like to create a zabbix trigger with the available memory and total memory for a particular host. How is this possible with one trigger.My requirement is to have both available memory and the total memory listed in the action mail.


Solution

  • For example, you can use a trigger like this to check that available memory is less than 10% of the total:

    {Template OS Linux:vm.memory.size[available].max(#3)} <
        0.1 * {Template OS Linux:vm.memory.size[total].last()}
    

    In the action email, you can then reference item names, keys, and values like so:

    Item values:
    
    1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}
    2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}
    3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}
    

    In the example above, {ITEM.KEY1} refers to vm.memory.size[available] and {ITEM.KEY2} refers to vm.memory.size[total]. Similarly for other macros. {ITEM.KEY3} will expand to *UNKNOWN*, because there is no third item in the trigger expression.

    Such an email format comes with Zabbix 2.2 and Zabbix 2.4 by default.