Ad Widget

Collapse

How to structure triggers with clusters & dynamic inventory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sfr
    Junior Member
    • Nov 2015
    • 6

    #1

    How to structure triggers with clusters & dynamic inventory

    Hi

    Let's say I have a MySQL cluster of around 50 amazon instances that dynamically scale up and down depending on load.

    I want to have a trigger in zabbix that checks on a specific return value from a MySQL query on the cluster. Could be getting a
    Code:
    COUNT()
    from a table, or checking the status of cluster synchronization (which is done via something like
    Code:
    show global status where Variable_name='wsrep_evs_repl_latency'
    )

    So I add this trigger to my MySQL Cluster Server Zabbix template.

    But what I don't want is for all of the 50 servers to generate 50 duplicate pager calls and email alerts whenever this trigger fires – 1 is enough.

    What I've done so far is simply creating the trigger directly on a random MySQL node, but then the trigger obviously stops working when auto scaling removes that node/server.

    So where do I put my trigger?

    Since Zabbix is 100% host-based, I guess I could put it on the Zabbix Server itself, but of course I also autoscale my zabbix environment due to load, and then I have the same problem.

    Any pointers on this?
  • sfr
    Junior Member
    • Nov 2015
    • 6

    #2
    bumpety bump

    Comment

    • shuum
      Junior Member
      • Dec 2019
      • 11

      #3
      Have you come up with solutions?

      Comment

      • sfr
        Junior Member
        • Nov 2015
        • 6

        #4
        I just tried searching for this again in 2023, and only found my own post.

        Zabbix has zero support for clustered systems, still.

        Comment

        • seren
          Junior Member
          • Jun 2023
          • 10

          #5
          I believe you can do what you are/were trying to do using aggregations (https://www.zabbix.com/documentation...ated/aggregate).

          So each MySQL host would have an item such as `mysql.cluster.latency`. Then you create a pseudo host (ex. "MySQL-Cluster") with a single trigger like (assuming the servers are in a host group "MySQL-Servers" and you have tags per environment).

          Some made up examples:

          This takes the max value of the reported cluster latency (which should be the same across all nodes):
          Code:
          max(last_foreach(/*/mysql.cluster.latency?[group="MySQL-Servers" and tag="env:production"])) > {$MYSQL.CLUSTER.MAXLATENCY}
          This checks that all running servers are in the cluster:
          Code:
          min(last_foreach(/*/mysql.cluster.membercount?[group="MySQL-Servers" and tag="env:production"]​)) < sum(last_foreach(/*/agent.ping?[group="MySQL-Servers" and tag="env:production]))

          Comment

          Working...