Skip to content

Commit

Permalink
proxy loadbalancing
Browse files Browse the repository at this point in the history
  • Loading branch information
Trikke76 committed May 28, 2024
1 parent 2900300 commit 3faa734
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 42 deletions.
Binary file added docs/proxies/image/monitor-by-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/proxies/image/proxy-group-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/proxies/image/proxy-group-online.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/proxies/image/proxy-loadbalancing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/proxies/image/proxy-loadbalancing2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 76 additions & 3 deletions docs/proxies/loadbalancing-proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ I have set up 3 proxies for this example:
- ProxyA2
- ProxyA3

each of them has a unique IP.
each of them has a unique IP and hostname.

So once you have set up 3 proxies and have added them into the frontend like we did for active and passive proxies you should have a similar looking config in your Administration frontend under Proxies.

![3 active proxies](image/3-active-proxies.png)


Before we start to create a loadbalancing group there are a few steps we need to fix first. We need to monitor our proxies and we also need to install some Zabbix agengs on the proxies.
Before we start to create a loadbalancing group there are a few steps we need to fix first. We need to monitor our proxies and we also need to install some Zabbix agents on the proxies.
To install the agents we have to follow a few simple steps.

On every proxy run the following commands:
Expand All @@ -44,6 +44,8 @@ Now we have to adjust a few configuration options.
- ServerActive: A list of IP adressess or DNS names pointing to our zabbix servers. This is for the Active agent only.
- Hostname: The hostname of our proxy server

So set the unique hostname and point every proxy for Server and or ServerActive to the IP of your Zabbix proxy and not the Zabbix server. Our Proxy is in this case acting as our Zabbix server.

Do this for all the agents that are installed on the proxies and when done start the agents and enable them to start automatic.

```
Expand Down Expand Up @@ -80,10 +82,81 @@ Here we have to define a few options:

![proxy group](image/proxy-group.png)

As a final step we have to confgiure our 3 existing proxies to join this proxy group.
Next we have to configure our 3 existing proxies to join this proxy group.
Go in the Zabbix menu to ```Administration -> Proxies```
click on every proxy in the list you would like to add to the group and enter following details.


![proxy group online](image/proxy-group-config.png)

- Proxy group: ```Active proxies``` (or whatever name you gave to your proxy group.)
- Proxy address: The active proxy ip, If specified then active proxy requests are only accepted from this list of comma-delimited IP addresses, optionally in CIDR notation, or DNS names of active Zabbix proxy.
- Address for active agents: The address and port where active agents will connect to. Usually same IP as the IP from the proxy but not needed to be the same.
- Proxy Mode: Configure if it proxy is Active or Passive

![proxy group online](image/proxy-group-online.png)

The next step is now to reconfigure our Agents on our proxies so that they are monitored by The proxy group ```Active Proxies``` instead of only the proxy they run on.
Go to ```Data collection -> Hosts``` and click on every host that you have configured to monitor the proxy agent. Switch Monitored by ```Proxy``` to ```Proxy group```.

![monitor by group](image/monitor-by-group.png)

Because our proxies will accept active connections make sure to open firewall port 10051 on all the proxies and because we have Agents that we monitor passive make sure port 10050 is also open

```
firewall-cmd --add-port=10051/tcp --permanent
firewall-cmd --add-port=10050/tcp --permanent
firewall-cmd --reload
```

Now there is another step that we need to fix. On our Zabbix Agents we need to add all the proxy addresses to our Zabbix agents configuration.

open the file ```/etc/zabbix/zabbix_agentd.conf``` and add a comma delimited list of IPs for ```Server``` and ```ServerActive``` pointing to all your proxies
This way the agent can sent active data to the proxies or it can be polled by all 3 proxies

???+ Note
Don't forget to restart your agents and proxies when making changes in the configuration files.

## Loadbalancing and HA

Ok now that we have configured our proxies and agents properly and made a proxy group everything is up and running. When you go to ```Data Collection -> Hosts``` you will see that your proxie agents are monitored by the group ```Active proxies```. It is possible that your ProxyA1 is monitored by ProxyA2 or A3 so don't panic if your dashboard is not the same. Zabbix proxies will besides HA also do loadbalancing.

![monitor by group](image/proxy-loadbalancing.png)

It's time to test this so let us stop one of our proxies for example ProxyA2

```
systemctl stop zabbix-proxy
```

Since we configured our Proxy group failover period to be 1m it can take 1m before you will see changes


![monitor by group](image/proxy-loadbalancing2.png)


When you look at the log files of the agent you will see that he is not able to connect the proxy anymore and that he will be redirected to another proxy in the group

```
1391:20240528:115433.344 Unable to connect to [xxx.xxx.xxx.xxx]:10051 [cannot connect to [[xxx.xxx.xxx.xxx]:10051]: connection error (POLLERR,POLLHUP)]
1391:20240528:115433.344 Unable to send heartbeat message to [xxx.xxx.xxx.xxx]:10051 [cannot connect to [[xxx.xxx.xxx.xxx]:10051]: connection error (POLLERR,POLLHUP)]
1392:20240528:115433.344 Unable to connect to [xxx.xxx.xxx.xxx]:10051 [cannot connect to [[xxx.xxx.xxx.xxx]:10051]: connection error (POLLERR,POLLHUP)]
1392:20240528:115433.353 Unable to connect to [xxx.xxx.xxx.xxx]:10051 [cannot connect to [[xxx.xxx.xxx.xxx]:10051]: connection error (POLLERR,POLLHUP)]
1392:20240528:115433.355 Unable to send heartbeat message to [xxx.xxx.xxx.xxx]:10051 [sequential redirect responses detected]
1390:20240528:115433.407 Unable to connect to [xxx.xxx.xxx.xxx]:10051 [cannot connect to [[xxx.xxx.xxx.xxx]:10051]: connection error (POLLERR,POLLHUP)]
1390:20240528:115433.408 Unable to connect to [xxx.xxx.xxx.xxx]:10051 [cannot connect to [[xxx.xxx.xxx.xxx]:10051]: connection error (POLLERR,POLLHUP)]
1390:20240528:115433.408 Unable to send heartbeat message to [xxx.xxx.xxx.xxx]:10051 [sequential redirect responses detected]
1392:20240528:115533.508 Successfully sent heartbeat message to [xxx.xxx.xxx.xxx]:10051
1390:20240528:115533.562 Successfully sent heartbeat message to [xxx.xxx.xxx.xxx]:10051
1392:20240528:115558.583 Active check configuration update from [xxx.xxx.xxx.xxx:10051] is working again
1391:20240528:115558.598 Active check configuration update from [xxx.xxx.xxx.xxx:10051] is working again
```


???+ warning
There are a few limitations when using proxies in HA/Loadbalancing.
- SNMP traps are not supported by proxies in proxy group.
- Checks depending on external configuration must have the same configuration on all proxies in proxy group. That includes:
- external checks - scripts;
- database checks - odbc configuration.
- When monitored in proxy group the VMware hosts will be randomly spread between proxies in the group and will cause each proxy to cache all VMware data causing additional load to vCenter.
21 changes: 21 additions & 0 deletions site/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,27 @@









<li class="md-nav__item">
<a href="/Zabbix-Book/proxies/loadbalancing-proxies/" class="md-nav__link">


<span class="md-ellipsis">
Proxy loadbalancing
</span>


</a>
</li>




</ul>
</nav>

Expand Down
21 changes: 21 additions & 0 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,27 @@









<li class="md-nav__item">
<a href="proxies/loadbalancing-proxies/" class="md-nav__link">


<span class="md-ellipsis">
Proxy loadbalancing
</span>


</a>
</li>




</ul>
</nav>

Expand Down
2 changes: 1 addition & 1 deletion site/search/search_index.json

Large diffs are not rendered by default.

Loading

0 comments on commit 3faa734

Please sign in to comment.