Using Discovery with Zabbix proxies

We talked about Zabbix and discovery. It is a very good idea to edit your discovery rules if you followed along with that chapter. Let’s see how this would work in this recipe.

Getting ready

You’ll need to have finished Chapter 6, Using discovery for Automatic Creation, or have some discovery rules and active agent autoregistration setup.

I’ll be using lar-book-lnx-agent-auto, lar-book-disc-lnx, and lar-book-disc-win hosts in this example. We will also need our Zabbix server.

How to do it…

Let’s start with editing our discovery rule and then move on to editing our active agent to autoregister to the proxy.

Discovery rules

Starting with Zabbix discovery rules, let’s look at how to make sure we do this from the Zabbix proxy:

  1. Log in to the CLI of lar-book-disc-lnx and edit the /etc/zabbix/zabbix_agent2.conf file. Edit the following lines to include our Zabbix proxy address:
    Server=127.0.0.1,10.16.16.152,10.16.16.160,10.16.16.161
    ServerActive=10.16.16.160
  2. Restart your Zabbix agent by executing the following command:
    systemctl restart zabbix_agent2
  3. Now, make sure to log in to lar-book-disc-win and edit the C:\Program Files\Zabbix agent\zabbix_agentd file. Edit the following lines to include our Zabbix proxy address:
    Server=127.0.0.1,10.16.16.152,10.16.16.160,10.16.16.161
    ServerActive=10.16.16.160

    Important note

    At the ServerActive lines in our configuration files make sure to only include the Zabbix proxy we want to send data to. Zabbix agent will actively try to send data to our Proxy or Server listed here, so we should only list the one we want to use.

  4. Restart your Zabbix agent by executing the following commands in the Windows command line:
    zabbix_agentd.exe --stop
    zabbix_agentd.exe --start
  5. Next, navigate to Configuration | Hosts and delete the discovered hosts:

    lar-book-disc-lnx

    lar-book-discx-win

    We do this to prevent duplicate hosts.

  6. Now, navigate to Configuration | Discovery.
  7. Click on Discover Zabbix Agent hosts and change the Discovered by proxy field, as shown in the following screenshot:
    Figure 7.17 – Configuration | Actions, drop-down menu for discovery by proxy lar-book-proxy-active

    Figure 7.17 – Configuration | Actions, drop-down menu for discovery by proxy lar-book-proxy-active

  8. Click on the blue Update button, and that’s all there is to editing your discovery rule to be monitored by a proxy.
  9. You can now check out your newly discovered hosts under Configuration | Hosts and see that they are monitored by the proxy:
Figure 7.18 – Configuration | Hosts screen for discovered hosts

Figure 7.18 – Configuration | Hosts screen for discovered hosts

Active agent autoregistration

Moving on to active agent autoregistration, let’s see how we can do this from our Zabbix proxy:

  1. Start by navigating to Configuration | Hosts and deleting lar-book-lnx-agent-auto.
  2. To do active agent autoregistration to a proxy, we have to log in to our lar-book-lnx-agent-auto host CLI.
  3. Edit the Zabbix agent configuration file with the following command:
    vim /etc/zabbix/zabbix_agent2.conf
  4. Make sure to edit the following line to the Zabbix proxy address instead of the Zabbix server address:
    ServerActive=10.16.16.160
  5. Restart the Zabbix agent:
    systemctl restart zabbix-agent2.service
  6. We can now see our host autoregister to the Zabbix proxy instead of the Zabbix server:
Figure 7.19 – Configuration | Hosts screen for our two auto registered hosts

Figure 7.19 – Configuration | Hosts screen for our two auto registered hosts

How it works…

Discovery with a Zabbix proxy works exactly the same as discovery with Zabbix server. The only thing that changes is the location of where we are registering to or discovering from.

If you want to learn more about the process of discovery and auto registration, check out Chapter 6, Using Discovery for Automatic Creation if you haven’t already.

It will gives you output similar to below:

Related Articles

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

read more

Lorem ipsum dolor sit amet consectetur

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

seventeen − 17 =