Ad Widget

Collapse

Service on 2 hosts, trigger is both runs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lbm
    Member
    • Feb 2020
    • 36

    #1

    Service on 2 hosts, trigger is both runs

    Hi

    We have 2 nodes, where an service only needs to run, on one of them.
    What is the best way, to create an trigger which should alert in case the service runs on 2 nodes at the same time. ? Both nodes are part of an template, so I prefer if possible this could be done as part of this template.
    I've also looked at doing some macro stuff, but I cannot really get it to work.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2

    I think these functions might help you..

    Comment

    • milospt1
      Junior Member
      • May 2025
      • 10

      #3
      Slightly late reply, do you monitor those 2 nodes from two different hosts in zabbix or they are monitored from 1 host?

      Comment

      • lbm
        Member
        • Feb 2020
        • 36

        #4
        Originally posted by cyber
        https://www.zabbix.com/documentation...regate/foreach
        I think these functions might help you..
        Cannot really see how this can be done with an foreach ?

        Comment

        • lbm
          Member
          • Feb 2020
          • 36

          #5
          Originally posted by milospt1
          Slightly late reply, do you monitor those 2 nodes from two different hosts in zabbix or they are monitored from 1 host?
          Its two different nodes, monitoring from 1 single zabbix host/server.

          Comment

          • BP_Vital
            Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Feb 2016
            • 42

            #6
            So you have a single template for a host and you need to define a trigger based on conditions (service state) from 2 different hosts.
            Host A and Host B with a template X.

            Just a quick shot:
            Add a additional interface on host A pointing to host B (i guess in your case that would be zabbix agent(active)).
            Modify Template X to include an item service state using additional interface.
            Choose the corresponding (additional) interface for that item on host A.
            So host A will have an additional item - service state on host B.

            Now you can create a trigger to check service state on both hosts. (service state:A=1 AND service state:B=1)

            Don't forget to include additional interface on host B as well.
            Last edited by BP_Vital; 05-12-2025, 13:22.

            Comment

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

              #7
              Originally posted by lbm

              Cannot really see how this can be done with an foreach ?
              right.. maybe I was s bit short on this... those functions have option to select items based on tags.. so tag your items accordingly. and you should be able to use item selection by tags for a function (and hostgroup additionally, if required)... so if you have sum more than 1, you should get a trigger...

              Comment

              • milospt1
                Junior Member
                • May 2025
                • 10

                #8
                Originally posted by lbm

                Its two different nodes, monitoring from 1 single zabbix host/server.
                I have scenario where I have to check the state of a trigger from two hosts and I did that by creating a separate Pseudo Host that has and item which monitors items from two different hosts and based on their results, item in a pseudo host returns sort of like true or false which is then further used by trigger on Pseudo Host, details can be found in this post of mine https://www.zabbix.com/forum/zabbix-...-a-pseudo-host , maybe it will give you some ideas how to approach to your problem.

                Comment

                Working...