Ad Widget

Collapse

3 or more Zabbix Agents Unavailable in a Host Group

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BigDave
    Junior Member
    • Feb 2026
    • 3

    #1

    3 or more Zabbix Agents Unavailable in a Host Group

    Zabbix version 7.0.23

    I'm tryng to set-up a trigger if 3 or more Zabbix agents go unavailable in a Host Group. I understand that one option is to have a calculated item and then trigger off of that. I'm struggling with the formula for both

    Has anyone set-up something simliar so I can see how it's suppose to work?
    Last edited by BigDave; 26-02-2026, 17:20.
  • Answer selected by BigDave at 18-03-2026, 12:23.
    BigDave
    Junior Member
    • Feb 2026
    • 3

    Update -
    Using agent.ping was causing some false alarms so I replaced "agent.ping" and "is_online" in the items 'hosts_in_group' and 'hosts_online' with "zabbix[host,agent,available]"
    Also deleted the 'Is host online' item from the template

    So I have a host in each group with the below items -
    Click image for larger version

Name:	image.png
Views:	32
Size:	12.2 KB
ID:	511922
    Click image for larger version

Name:	image.png
Views:	19
Size:	12.1 KB
ID:	511923
    And this trigger -
    ​​​​Click image for larger version

Name:	image.png
Views:	19
Size:	14.9 KB
ID:	511924

    Comment

    • guntis_liepins
      Member
      • Oct 2025
      • 55

      #2
      This is a bit tricky question and solution I offer may be not optimal, but since nobody suggest anything better here will my 5 cents.

      1. we need some item common in host group which every host in this group has . I will use agent.ping in this example
      Make calculated item
      name hosts_in_group
      type Calculated
      key hosts_in_group
      Type of information integer
      formula sum(exists_foreach(/*/agent.ping?[group="test_servers"]))
      This work this way - exists_foreach Returns '1' for each enabled item , item selector - selects whole host group , then sum this value.
      As each host must return 1 if agent.ping is enabled, for each host then sum of all items will be equalt to a count of hosts in host group.

      2. we need item which returns 1 or 0 in each monitoring cycle, which would indicate if host are up or down.
      agent.ping does not fit out purpose as it returns 1 - available, but does not return data if not available.
      so we for every host create item is_online
      name Is host online
      type Calculated
      key is_online
      type of information Integer
      formula 1-nodata(//agent.ping,60s)
      Nodata will return 1 if host have not received successful agent.ping for one minute. So his item will return 0 if host is offline , but will return 1 if host is online.

      3. Now we create function which will show us ho many hosts are online
      name hosts_online
      type Calculated
      key hosts_online
      type of information integer
      formula sum(last_foreach(/*/is_online?[group="test_servers"]))
      This function will get last value for each is_online item in group test_servers then sum it together.
      As online hosts count as 1 , offline hosts as 0 this item will return integer host many hosts are online

      Now we can create trigger which will trigger when more than three hosts are offline (I created virtual host tt which hold two items hosts_in_group and hosts_online and created problem there )

      Attached Files

      Comment

      • BigDave
        Junior Member
        • Feb 2026
        • 3

        #3
        Thank you for the response.

        Would I be able to use zabbix[host,agent,available] instead of agent.ping?

        From what I've found agent.ping returns no data in case of unavailability, whereas zabbix[host,agent,available] returns a 0

        So I wouldn't need step 2 and can replace 'is_online?' in step 3 with 'zabbix[host,agent,available]?'

        Correct?

        Edit: Also to make this more difficult I have 3 host groups so this needs to work if 3 or more hosts are down in each group

        2nd Edit: SOLVED: Created a host per group with the items - 'hosts_in_group' &' hosts_online' and the trigger. Each other host has the 'Is host online' item created via their template.
        Last edited by BigDave; 04-03-2026, 18:46.

        Comment

        • guntis_liepins
          Member
          • Oct 2025
          • 55

          #4
          Sure. It was just example. Glad you made it!

          Comment

          • BigDave
            Junior Member
            • Feb 2026
            • 3

            #5
            Update -
            Using agent.ping was causing some false alarms so I replaced "agent.ping" and "is_online" in the items 'hosts_in_group' and 'hosts_online' with "zabbix[host,agent,available]"
            Also deleted the 'Is host online' item from the template

            So I have a host in each group with the below items -
            Click image for larger version

Name:	image.png
Views:	32
Size:	12.2 KB
ID:	511922
            Click image for larger version

Name:	image.png
Views:	19
Size:	12.1 KB
ID:	511923
            And this trigger -
            ​​​​Click image for larger version

Name:	image.png
Views:	19
Size:	14.9 KB
ID:	511924

            Comment

            Working...