Install Zabbix Agent on a VM Behind a Firewall
Video Lecture
Description
Zabbix agent can also be installed in VMs hosted on your local PC.
In this lecture I am using Oracle Virtual Box on Windows 10 with an Ubuntu 20.04 VM. I also provide the Centos 7 commands below.
Note
An important setting for VMs regards how they can be found on the network. In order for Zabbix Server to communicate with it, it will need an IP address on your local network. In my configuration, I configure the VMs network adapter as a bridged adapter and my routers DHCP auto assigns it an IP address.
This host is also behind a firewall, so I will need to set up another port forwarding rule.
Since I have already set up a rule for the external IP, port 10050 and 10052, I will need to use another port. I use the external IP, and port 10053. This will then forward to the internal host with the agent running and listening on the default port of 10050.
Ubuntu 20.04
The detailed download instructions are at https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/debian_ubuntu
Install Repositories
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
dpkg -i zabbix-release_5.0-1+focal_all.deb
apt update
Install Zabbix Agent service
sudo apt install zabbix-agent
then configure it by editing parameters for Server, ServerActive and Hostname and save.
sudo nano /etc/zabbix/zabbix_agentd.conf
Then start it,
service zabbix-agent start
service zabbix-agent status
Then go to Zabbix-Server and create a new host.
Centos 7
The detailed download instructions are at https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/rhel_centos
The commands in this video are,
sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sudo yum clean all
sudo yum install zabbix-agent
then configure it,
sudo nano /etc/zabbix/zabbix_agentd.conf
Edit parameters for Server, ServerActive and Hostname and save.
Then,
sudo systemctl start zabbix-agent.service
sudo systemctl status zabbix-agent.service
Then go to Zabbix-Server and create a new host.
Centos 7 also has it's own internal firewall that will also need to be configured.
I need to allow TCP connections to port 10050
firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --reload
firewall-cmd --list-ports