Ad Widget

Collapse

zabbix HA behind reverse proxy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • db100
    Member
    • Feb 2023
    • 61

    #1

    zabbix HA behind reverse proxy

    Dear all,

    in a situation where 2 zabbix servers are in HA modus and reachable to the clients via a reverse proxy (haproxy / traefik, etc), is it possible for the reverse proxy to figure out which one node is the current master, so as to remove the other(s) from the load balancing routine?

    example in traefik one could use healthchecks: https://doc.traefik.io/traefik/routi.../#health-check

    this is quite an important feature to have
  • Steven09
    Junior Member
    • Jul 2023
    • 4

    #2
    Traefik supports health checks to monitor the status of backend servers. You can configure Traefik to periodically check the health of both Zabbix servers, typically using HTTP/HTTPS health checks to a specific endpoint or port exposed by the Zabbix servers.

    Comment

    • db100
      Member
      • Feb 2023
      • 61

      #3
      Steven09 thanks for the reply. as highlighted in my comment above, health-check only works with HTTP endpoints, but the zabbix-server does not expose any. i wonder whether i should use haproxy instead, but then again, would the standard tcp port return an "error" when the server is in standby mode ? or how to figure out that a server is in standby ?

      Comment

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

        #4
        You can find which host is active from DB, table ha_node.

        Comment

        • db100
          Member
          • Feb 2023
          • 61

          #5
          but reverse proxies cannot read stuff from DBs, thats why i am trying to figure that out via TCP protocol, is there any way to do that ?

          Comment

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

            #6
            If 10051 port answers, then that one is active... Inactive node does not listen on that port...

            Comment

            • db100
              Member
              • Feb 2023
              • 61

              #7
              i see, ok i will check this then, if it is possible to achieve something with traefik

              Comment

              • db100
                Member
                • Feb 2023
                • 61

                #8
                using haproxy as reverse proxy in front of 2 (or more) zabbix servers does the job. here i share the config i am using, hopefully this will benefit someone out there. Btw, you could think to add this to the official helm chart of zabbix:

                Code:
                # taken from: https://www.securityandit.com/network/haproxy-for-service-discovery-in-kubernetes/
                global
                    log stdout format raw local0 notice
                    daemon
                    maxconn 10000
                resolvers kubernetes
                    nameserver dns1 <k8s_dns_ip>:53
                    resolve_retries       3
                    timeout retry         1s
                    hold valid            5s
                    accepted_payload_size 8192
                # Add stats page configuration for HAProxy GUI
                listen stats
                    bind *:8404  # Bind stats page to port 8404
                    stats enable
                    mode http
                    stats uri /stats
                    stats refresh 10s
                defaults
                    log global
                    mode tcp
                    timeout connect 5s
                    timeout client  10s
                    timeout server  10s
                frontend zabbix-frontend
                    bind *:10051
                    default_backend zabbix-backend
                backend zabbix-backend
                    balance roundrobin
                    option tcp-check
                    timeout connect 3s
                    timeout server  5s
                    timeout check   5s
                    server-template zabbix 3 zabbix-zabbix-server-ha.<namespace>.svc.cluster.local:10051 resolvers kubernetes resolve-prefer ipv4 check

                Comment

                Working...