Ad Widget

Collapse

using key item value from template items into custom message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neorejdv76
    Junior Member
    • Nov 2021
    • 15

    #1

    using key item value from template items into custom message

    Hi,

    On the zabbix agent there are two userparameter.
    One is just a counter.
    The other is some text with some information.

    I've made two items in a new tempate. One is getting the counter and the other one is getting the text field.
    This works because i can see the values in latest data of the host.

    I've made a trigger. basically if the count is higher then 0 a tigger is made active.
    This works as designed.

    In actions i have made a new action. When the trigger (made in the new template) has been triggered, a custom message will be send via email.
    In the mail message i specified the {HOST.NAME} value and the counter {ITEM.VALUE1}.
    so it says something like: "Ön <hostname> are <counter value> sessions active"

    So far so good.

    The next part I cannot solve.

    I want to add the contents of that text field from the other item in to this custom message. {ITEM.VALUE2} does not work.
    How do a pass a second item with a value into this message?
    I have looked on serveral places, but the result is a *UNKNOW* value in the custom message.

    Can anyone explain to me how i must solve this?

    Thx in advance!


  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    What do docs say?
    The indexed macro syntax of {MACRO<1-9>} works only in the context of trigger expressions. It can be used to reference hosts or functions in the order in which they appear in the expression.​
    So .. if you are not using that value in trigger expression, you cannot also refer to it...
    Solution... add additional clause to your trigger expression, where you use that other item, in a way, that it does not affect initial calculation.... like "last(host/key1)>0 and length(/host/key2)​>0" that key2 has some value, so should be true always and does not influence your initial trigger calculation.
    and then you can refer to that item also in your message as {ITEM.VALUE2}

    Comment

    • neorejdv76
      Junior Member
      • Nov 2021
      • 15

      #3
      Thanks cyber!
      I understand it and it works.

      Comment

      Working...