Ad Widget

Collapse

Using tags in triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guest6936
    Junior Member
    • Mar 2022
    • 25

    #1

    Using tags in triggers

    Hello,

    I am wondering if it is possible to use tags in the trigger expression? We do not wish to execute the trigger if its host has a specific tag.

    I imagine my pseudo expression to look like this where {HOST.TAG.run_trigger} is all imaginary.

    Code:
    last(/MyTemplate/net.tcp.listen[9000])<>1 and {HOST.TAG.run_trigger}=false
    My issue is that we have servers in certain unstable regions that creates a lot of alerts & problems (as expected). But we do not wish the some triggers to go crazy about this, but still collect the data via our Items. Basically we wish to disable some triggers if they have a specific tag name or value.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    No, you cannot use them in expression. Tags are event level things. they are attached to the generated event.
    You can just disable those triggers in those problematic hosts. Data collection will still go on.

    Comment

    • guest6936
      Junior Member
      • Mar 2022
      • 25

      #3
      Originally posted by cyber
      No, you cannot use them in expression. Tags are event level things. they are attached to the generated event.
      You can just disable those triggers in those problematic hosts. Data collection will still go on.
      Yeah, I was thinking if I could do something more automatic. Now I have to disable 8-10 triggers on every "problematic" host I create in my template. Manual labour is prone to mistakes.

      Comment

      • Semiadmin
        Senior Member
        • Oct 2014
        • 1625

        #4
        There is one trick.
        In 5.4 and 6.0 you may use tag in calculated item formula and put such item in a trigger condition.
        For example, in 6.0:
        1. Create a calculated item tag.exists with formula:
        Code:
        item_count(//agent.ping?[(tag="run_trigger:")])
        2. Use it in a trigger:
        Code:
        last(//net.tcp.listen[9000])<>1 and last(//tag.exists)

        Comment

        • Semiadmin
          Senior Member
          • Oct 2014
          • 1625

          #5
          Another way is to use user macro with values 0 or 1 instead of tag:
          Code:
          last(//net.tcp.listen[9000])<>1 and {$RUN_TRIGGERS}

          Comment

          • seren
            Junior Member
            • Jun 2023
            • 10

            #6
            Thanks for the clever trick with calculated items, Semiadmin! I have a template with items that need to be collected for every host, and triggers on those items that should only fire for production hosts. Maybe there's a better way to filter, but this seems to do the job.

            Comment

            Working...