- Zabbix how to add hosts – Easy setup in Linux and Windows
- A quick look on Zabbix
- How to add hosts in Zabbix?
- Add Linux hosts to Zabbix
- Add Windows hosts to Zabbix
- Conclusion
- PREVENT YOUR SERVER FROM CRASHING!
- How to Add Linux Host in Zabbix Server for Monitoring
- How to Install Zabbix agent on Ubuntu Linux?
- Step 1) Adding the Zabbix repository and Installing Zabbix agent
- Step 2) Configure Zabbix agent
- Step 3) Configure the firewall rules for zabbix-agent
- How to install zabbix agent on CentOS 8 / RHEL 8?
- Step 1) Adding the Zabbix repository
- Step 2) Configure zabbix agent
- Step 3) Configure the firewall rule for zabbix-agent
- Adding or Registering Remote Linux Host in Zabbix Server
- Graphing statistics of the remote hosts
- 3 thoughts on “How to Add Linux Host in Zabbix Server for Monitoring”
Zabbix how to add hosts – Easy setup in Linux and Windows
Basically, a Zabbix host can be anything from a physical or virtual server to a network switch.
At Bobcares, we often get requests to add hosts to Zabbix, as a part of our Server Management Services.
Today, let’s see how our Support Engineers add hosts in Zabbix.
A quick look on Zabbix
Zabbix is a monitoring software tool. We use it to monitor the parameters of the network, the health of servers, etc.
Also, Zabbix has a flexible notification mechanism. Therefore, it allows users to set up email alerts on any event.
In addition, the web-based frontend makes monitoring much easier.
How to add hosts in Zabbix?
A Zabbix host is any network device that we intend to monitor, with IP/DNS.
Usually, Zabbix adds hosts in two ways. One by scanning the network and adding the hosts in the server automatically. On the other hand, adding the host manually.
Let’s see how our Support Engineers manually add new hosts to Zabbix.
Add Linux hosts to Zabbix
Now, let’s have a look at how to add a host to Zabbix in Linux.
1. Firstly, we access the Zabbix admin panel.
2. Here, in the Configuration menu, we select the tab “Hosts“.
3. Next, we click the tab Create host. This opens up a host config form. And this appears as,
4. After that we add the necessary details like:
- Hostname – which is the name of the remote host.
- Group – Usually, we select one or more groups from the list. Because access permissions are only available for groups not for hosts.
- IP address – This is the IP of the host. We should update in the Zabbix agent config file server directives.
5. After entering the details, next, we select the template. For instance, a template has a set of entities already defined to reduce the monitoring efforts. However, a server can use an already existing template or add a new one.
6. Later, select the option Add link and save it.
Finally, the newly added host is present in the Zabbix monitoring system.
Add Windows hosts to Zabbix
Similarly, let’s see how our Support Engineers add a Windows host.
Initially, we access the Zabbix web browser panel.
And we navigate as Configuration >> Hosts >> Create host. Here we add the listed details.
But there is one parameter we consider. That is the hostname.
In Windows, this hostname must the same as that specified in the Zabbix agent config file.
Thereafter, we specify the other details. Later select a template and add it.
[Need assistance in adding hosts to Zabbix? – We’ll help you.]
Conclusion
So far, we saw how to add hosts to the Zabbix monitoring system. By adding new hosts, we can easily monitor this via the web bases control panel. We saw how our Support Engineers add hosts in Windows and Linux platforms.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
How to Add Linux Host in Zabbix Server for Monitoring
In the previous article, we have covered how to Install Zabbix Server on CentOS 8 . In this guide, we go a step further and show you how you can add a Linux host to the Zabbix Server so that we can monitor various metrics such as CPU load , memory utilization , swap usage , and disk utilization to mention a few.
But first, we need to install the Zabbix Agent on the remote host which is going to ship the metrics of the remote system to the Zabbix server for monitoring. In this guide, we will install the Zabbix agent on Ubuntu 20.04 LTS and CentOS 8.
How to Install Zabbix agent on Ubuntu Linux?
To get started with the installation of Zabbix agent, follow the steps below:
Step 1) Adding the Zabbix repository and Installing Zabbix agent
By default, the Zabbix repository is not included in the Ubuntu repository. We, therefore, need to manually add it before installing the Zabbix agent. At the time of penning down this guide, the latest version of Zabbix is Zabbix 5.0. Therefore, we are going to add the Zabbix agent that corresponds to that version.
To so do, first download the repository’s Debian package:
For Ubuntu 20.04 (Focal Fossa)
$ wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bfocal_all.deb
After the package is downloaded, update the package list and install the zabbix-agent using the dpkg package manager as shown:
$ sudo apt update $ sudo dpkg -i zabbix-release_5.0-1+focal_all.deb or $ sudo apt install -y zabbix-agent
For Ubuntu 18.04 (Bionic Beaver)
For Ubuntu 18.04, execute the commands below to add the repository
$ wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bbionic_all.deb $ sudo apt update $ sudo dpkg -i zabbix-release_5.0-1+bionic_all.deb or $ sudo apt install -y zabbix-agent
For Ubuntu 16.04 (Xenial Xerus)
$ wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bxenial_all.deb $ sudo apt update $ sudo dpkg -i zabbix-release_5.0-1+xenial_all.deb or $ sudo apt-get install -y zabbix-agent
Step 2) Configure Zabbix agent
With the successful installation of the Zabbix agent, we need to make a couple of tweaks for the remote system to communicate with the Zabbix server. We are going to make a few adjustments in the configuration file which is /etc/zabbix/zabbix_agentd.conf
In the file locate the Server and hostname attributes and set them to correspond to the server’s parameters. In our case, we have:
Server=10.128.0.10 hostname=ubuntu20-04
Once done, save & exit the configuration file.
Also, ensure that you can reach the Zabbix server by pinging its IP address and hostname.
For the changes to come into effect, restart the Zabbix-agent as shown:
$ sudo systemctl restart zabbix-agent
To ensure it is running, check its status using the command:
$ sudo systemctl status zabbix-agent
From the output, it’s clear that the Zabbix agent is up and running.
Step 3) Configure the firewall rules for zabbix-agent
Finally, we need to configure the firewall to open port 10050 which the zabbix-agent listens on. Therefore, run the commands below:
$ sudo ufw allow 10050/tcp $ sudo ufw reload
To confirm that the port is open, run:
Up to this mark, you have successfully installed the Zabbix agent on Ubuntu and your system is ready to be added to the Zabbix server for monitoring.
How to install zabbix agent on CentOS 8 / RHEL 8?
For CentOS 8 / RHEL 8 systems, the steps for installing the Zabbix agent are pretty much similar.
Step 1) Adding the Zabbix repository
Begin by manually adding the repository since the Zabbix repository is not included by default on AppStream repo.
$ sudo dnf install https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-agent-5.0.0-1.el8.x86_64.rpm
Press Y to finish the installation.
Run below command to install Zabbix Agent on CentOS 8 / RHEL 8
$ sudo dnf install -y zabbix-agent
Step 2) Configure zabbix agent
As demonstrated earlier, a few changes need to be made in the agent’s configuration which is / etc/zabbix/zabbix_agentd.conf
As before, set the Server and hostname directives to match the Zabbix server’s parameters as shown:
Server=10.128.0.10 hostname=centos-8
Once done, save & exit the configuration file. Next, restart the Zabbix-agent daemon and confirm whether it’s running:
$ sudo systemctl restart zabbix-agent $ sudo systemctl status zabbix-agent
Step 3) Configure the firewall rule for zabbix-agent
Finally, to allow Zabbix-agent to establish communication with the Zabbix Server and vice versa , configure the firewall by running the commands as shown:
$ sudo firewalld --add-port=10050/tcp --permanent $ sudo firewalld --reload
Adding or Registering Remote Linux Host in Zabbix Server
Login to your Zabbix Server portal using admin user’s credentials .To add a host on the Zabbix server, click on Configuration –> Hosts.
On the far top- right end, click on the ‘ Create host’ button
On the page that appears, fill out the remote Linux’s details as listed:
Next, click on the ‘ select ’ button next to the ‘ Groups ’ text field. On the ‘ Host groups ’ list, click on ‘ Linux servers ’ and then click ‘ Select ’.
As you can see, the group has been added.
We also need to add a template for our server. So, click on the ‘ Templates ’ menu option.
On the ‘ Templates ’ list that appears, click on ‘ Template OS Linux by Zabbix agent ’ and hit the ‘ Select ’ button.
This takes you back to the home screen and there you can see that your new host system has been added.
To add the CentOS-8 system, repeat the same steps described.
Graphing statistics of the remote hosts
To represent system metrics in a graphical form, click on ‘ Monitoring ’ –> ‘ Hosts ’
Next, click on the host you want to graph and select the ‘ graph ’ option from the pull-up menu.
Zabbix server will begin generating various graphs representing various system metrics such as Processes, CPU load, and network traffic statistics to mention a few.
Scroll down to view other graphs displaying various metrics as shown below.
We have successfully added 2 Linux host systems to the Zabbix server and managed to graph various system metrics. We appreciate your feedback. Give it a try and let us know your experience.
3 thoughts on “How to Add Linux Host in Zabbix Server for Monitoring”
Hello, Thank you for this good explanantion, I have added hosts on Zabbix 6 however all Linux host are grayed out, inteface status is showing unknown. What can I do to make them available (green color?) Reply
Hello Magwai. Kindly ensure that port 10050 has been opened on the firewall for all the nodes in your setup. Then restart the firewall for the changes to come into effect. Let me know how this goes. Reply
Hello James Kiarie,
Thank you for your reply. Firewall is not running (disabled) for all nodes. SELinux is disabled. Please find below Node01 settings if it can help
[[email protected] ~]# sestatus
SELinux status: disabled
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# firewall-cmd –list-ports
FirewallD is not running [[email protected] ~]# systemctl status firewalld
● firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[[email protected] ~]# [[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# grep -vE ‘#|^$’ /etc/zabbix/zabbix_agentd.conf
PidFile=/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.1.20 #### Zabbix Server IP
ServerActive=192.168.1.20
Hostname=192.168.1.40 #### Node01 IP
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# systemctl status zabbix-agent
● zabbix-agent.service – Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-09-26 15:38:46 EAT; 3 days ago
Process: 11373 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 11376 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 11379 (zabbix_agentd)
Tasks: 6
CGroup: /system.slice/zabbix-agent.service
├─11379 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─11380 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─11381 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─11382 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─11383 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─11384 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec] Sep 26 15:38:46 node01 systemd[1]: Stopped Zabbix Agent.
Sep 26 15:38:46 node01 systemd[1]: Starting Zabbix Agent…
Sep 26 15:38:46 node01 systemd[1]: Started Zabbix Agent. Reply