Ad Widget

Collapse

using proxy in clustered environment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hakanozanlagan
    Member
    • Nov 2021
    • 35

    #1

    using proxy in clustered environment

    I have a Zabbix cluster server with 2 nodes. I need to set up a Zabbix proxy for this environment. However, Zabbix proxy does not allow the use of two IP addresses in the "Server=" definition and we can only use one IP address.
    I tried to do it with a load balancer. However, Zabbix cluster is running simultaneously with port 1051 open on both nodes and there is no way for the load balancer to understand which node is active.
    Is there a way to use a Zabbix proxy in a clustered environment?​
  • Moob
    Member
    • Mar 2025
    • 31

    #2
    Hi,

    What if you use 2 FQDN's with the same name but with different IP address, one for each of your nodes, and use that as the Server address in your proxy configuration ?

    Regards

    Comment

    • psargent
      Junior Member
      • Apr 2025
      • 5

      #3
      Yes. You can have 2 IP addresses in the proxy conf. The separator is a semi colon.
      Server=address colon port;address2 colon port of Zabbix server

      Comment

      • hakanozanlagan
        Member
        • Nov 2021
        • 35

        #4
        Originally posted by psargent
        Yes. You can have 2 IP addresses in the proxy conf. The separator is a semi colon.
        Server=address colon port;address2 colon port of Zabbix server
        I tried below configs Proxy server is failed to start. it is running in agent conf but proxy is not supporting multiple server config.

        Server=192.168.88.100:10051,192.168.88.101:10051
        or
        Server=192.168.88.100,192.168.88.101

        Comment

        • hakanozanlagan
          Member
          • Nov 2021
          • 35

          #5
          I solved problem with workaround.

          # add cluster status in "/usr/share/zabbix/clusterstatus.txt" file on both nodes via cron. (0 or 1)
          * * * * * zabbix_server -R ha_status |grep -c "Last Access" > /usr/share/zabbix/clusterstatus.txt

          #check server status and take action on proxy side.
          * * * * * /etc/zabbix/scripts/proxycheck.sh


          cat proxycheck.sh
          #!/bin/bash

          proxyActiveIp=$(grep "^Server=" /etc/zabbix/zabbix_proxy.conf |awk -F"=" '{print $2}')
          zbxsrv01status=$(curl -sk https://zbxsrv01.eduenv.com/clusterstatus.txt)
          zbxsrv02status=$(curl -sk https://zbxsrv02.eduenv.com/clusterstatus.txt)


          #check for nodes (192.168.88.100,192.168.88.101)
          if [ $zbxsrv01status == 1 ] && [ $proxyActiveIp != "192.168.88.100" ]
          then
          sed -i 's/^Server=192\.168\.88\.101$/Server=192.168.88.100/' /etc/zabbix/zabbix_proxy.conf
          systemctl restart zabbix-proxy

          elif [ $zbxsrv02status == 1 ] && [ $proxyActiveIp != "192.168.88.101" ]
          then
          sed -i 's/^Server=192\.168\.88\.100$/Server=192.168.88.101/' /etc/zabbix/zabbix_proxy.conf
          systemctl restart zabbix-proxy
          fi
          Last edited by hakanozanlagan; 08-05-2025, 09:24.

          Comment

          • psargent
            Junior Member
            • Apr 2025
            • 5

            #6
            The separator in the proxy config needs to be a semi colon.
            Server=192.168.88.100:10051;192.168.88.101:10051
            or
            Server=192.168.88.100;192.168.88.101​

            Comment

            • hakanozanlagan
              Member
              • Nov 2021
              • 35

              #7
              Originally posted by psargent
              The separator in the proxy config needs to be a semi colon.
              Server=192.168.88.100:10051;192.168.88.101:10051
              or
              Server=192.168.88.100;192.168.88.101

              I didn't pay attention to the comment and just looked at the line below and saw the semicolon as a comma. It worked when I used a semicolon, thanks
              Server=address colon port;address2 colon port of Zabbix server

              Comment

              Working...