The Eye of Sauron

Add Machines to Monitor

Now that the infrastructure is all deployed and configured, you can put it to real use by setting up a client for monitoring. The first machine to monitor will be the one on which you’ve set up the Zabbix server.

Since you’ve already added the Zabbix repository in this Ubuntu 18.04 installation, you will simply pull in the Zabbix agent:

$ sudo apt install zabbix-agent

Once it’s installed, start the agent, and set it up to start automatically at boot:

$ sudo systemctl start zabbix-agent
$ sudo systemctl enable zabbix-agent

All network devices that Zabbix monitors are known as hosts. The Zabbix server host that you’ve just installed the agent on is disabled by default; you’ll need to enable it manually before it can receive data from the agent. To do this head to Configuration | Hosts. The page will only list a single host named Zabbix server. Select the entry before clicking the Enable button to bring the monitoring server online.

Adding the local Zabbix server as a host is very simple and straightforward since there isn’t any real configuration installed. The agent is installed locally, so it requires no configuration, and there’s no need to take steps to send the data over an encrypted channel.

Zabbix Agent on a Remote Host

The process for monitoring a remote host is a little more involved. Begin the process by first adding the official Zabbix repository to the remote host you wish to monitor. Follow the instructions in the Zabbix manual to grab the relevant repository packages for either the RPM or DEB based distribution. Once you’ve installed the Zabbix repository, use the package management tools to pull in the zabbix-agent package.

After installing the packages, open the Zabbix agent’s configuration file:

$ sudo nano /etc/zabbix/zabbix_agentd.conf

Scroll the file to find lines mentioned below and uncomment them to point to your Zabbix server and give it a unique name:

Server=192.168.0.50
Hostname=FedoraWorkstation

Make sure you modify the entries as per your environment. After making the modification, start the agent and enable it just as you did earlier on the Zabbix server. Remember that if the remote host is behind a firewall, you’ll also need to open the 10050/TCP port for the agent to talk to the Zabbix server. On Ubuntu you can do this with:

$ sudo ufw allow 10050/tcp

In a production environment, it’s advisable to use certificates or pre-shared keys to encrypt the connection between the clients and the Zabbix server. Again, the Encryption chapter in the official Zabbix documentation covers the topic in detail. For now, I’ll just add the remote hosts without any encryption.

Head back to the Zabbix server and fire up the Zabbix front end. Login and navigate to Configuration | Hosts and click on the Create Host button in the top right corner. Here, you’ll need to enter the hostname of the monitored zabbix-agent machine. Make sure this is the same as the one you’ve mentioned in the agent configuration file earlier. Next, you’ll need to select the group in which you want to add the system. Since we are running the Zabbix agent to monitor a basic Linux server, we can choose the Linux server group. Enter the IP address of the remote host on which the Zabbix agent is running and also optionally enter a brief description of the host.

Now, switch to the new host interface's Template tab to add a template for the remote host. In this case, I’ll choose the Template OS Linux (Figure 5), which best describes our remote host. Click on Add to assign the template to the host. Once done, you can click the Add button to add the new host to the Zabbix server.

Figure 5: You can assign several templates to one host.

After a few minutes, the ZBX button under availability will turn green (Figure 6). This signifies that the host is available using the Zabbix agent and actively sending events from the host computer to the Zabbix server.

Figure 6: If the ZBX availability turns red, weed out any errors in the server and agent logfiles.

That’s it, you can now head to the monitoring tab to view all kinds of details about the server (Figure 7). I’ve just scratched the surface of the Zabbix monitoring app, and there’s a lot more you can do with it. For instance, manually adding agents isn’t feasible in a network with dozens of hosts. To aid mass deployment, here’s how you can automatically register Zabbix clients. Also make sure you read through the official Zabbix documentation to fully appreciate Zabbix's capabilities.

Figure 7: Use the pull-down menus under Monitoring | Graphs to view the monitored parameters for the selected host.

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Leaving Nagios

    Many enterprises use the free Nagios monitoring solution; some would prefer to change to something else. We talked to people who switched to find out how they fared.

  • Prometheus

    Legacy monitoring solutions are fine for small-to-medium-sized networks, but complex environments benefit from a different approach. Prometheus is an interesting alternative to classic tools like Nagios.

  • Hyperic HQ

    Monitor a Java application server with Hyperic HQ.

  • Netdata

    Netdata helps you monitor your network with ease through a cloud dashboard.

  • Checkmk

    We'll show you how to use the Checkmk open source monitoring tool to monitor your home router.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News