Ad Widget

Collapse

Verify if {HOST.IP} is part of an calculated item value (list)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ludoviclemoine
    Junior Member
    • Dec 2025
    • 1

    #1

    Verify if {HOST.IP} is part of an calculated item value (list)

    Dear Zabbix Community,

    I came across an issue recently and I wanted to ask you if you have any suggestions to this (or had similar use cases).

    A calculated item has a value (list of objects), that looks like this:
    Code:
    ["IP":"1.1.1.1","IP":"2.2.2.2"]
    I want to create a trigger that fires when the value of the built-in macro {HOST.IP} is not found in this list. I have tried to do it several ways, through an item or a trigger, both with a syntax like seen below:
    Code:
    find(/host/my-calculated-item,,"regexp","\"{HOST.IP}\"") <> 1
    But without success, as {HOST.IP} is not being resolved in this context (as per documentation). Apart from doing this externally, via API or maybe with a discovery rule, do you see any other option I could use to make this trigger work ?
    The idea is to make a template and attach it to multiple hosts, so I am looking for a convenient solution that is not too greedy in terms of resources.

    Thank you in advance for your ideas :-)

    Kind regards,
    Ludovic
  • markosa
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Aug 2022
    • 104

    #2
    We have similar need to detect if our devices have proper IP-settings. This is our trigger, manip1 item needs to contain either of those IPs: find(/THISISMYHOST/manip1,,"regexp","123\\.45\\.0\\.160|123\\.45\\.67 \\.40")=0
    You could use usermacro to have same syntax for IP stored in template {$MACRO1} = ^123\.45\.0\.160$ {$MACRO2} = ^123\.45\.67\.40$ and use those macros in trigger.....

    Comment


    • ludoviclemoine
      ludoviclemoine commented
      Editing a comment
      Hello Markosa,
      Thank you for your feedback. If my understanding is right, you suggest to duplicate the value of "["IP":"1.1.1.1","IP":"2.2.2.2"]" into a user macro {$MACRO1} ?
      If this is the case, we want to avoid this. We are now working on using an external Zabbix module (in-house dev proxy) to make the required API calls and do the comparison outside of Zabbix, then populate a file and setup an item with the comparison result, but if there is any solution that works from within Zabbix, we would be happy to try it.
      Kind regards,
      Ludovic
Working...