How to install Zabbix Agent on Amazon Linux

Istiaque Islam
Monstar Lab Bangladesh Engineering
3 min readAug 2, 2019

As a system admin, you must know the necessity of having a monitoring service. There are tons of monitoring services with paid and unpaid subscription. Zabbix is one of them which you can host on your system easily. You may have some small amount of servers or VMS, so why will you tend to pay for extra resources? For your necessity, Zabbix is there for you.

In an AWS account, even if you have two or three servers to host, a t2.micro server is good enough for you to get the real-time monitoring data.

You can use any Linux distribution (CentOS, Fedora, Ubuntu, Amazon Linux) to configure a Zabbix monitoring server. I prefer ubuntu since the support and related troubleshooting docs are widely available on the internet.

Although there are articles about Zabbix servers installation on the web, I have faced challenges to install the agent on Amazon Linux. As you know, you will not have the liberty to get all your application servers in ubuntu, windows or centos.

What were the difficulties:

Which version to use?

Which repo to use for Amazon Linux?

What are the installation Commands?

How to configure AWS security groups for Zabbix?

How to test successful connection between Zabbix Host and Zabbix Agent?

Let’s find the answers.

What version to use?

If you use your zabbix host version 4.2 then you should use the same version of agent 4.2.

You will get all the versions over here:

Click on the link to Zabbix-Agent Version

For my experiment, I have used version 4.2.

Which repo to use for Amazon linux?

Amazon linux distribution has some features like Red Hat Linux and CentOS both. Therefore for Zabbix agent it is okay to use Redhat Linux distribution.

You get the agent installation file from here

What are the installation commands?

Now I talk business right! Let’s follow the command one by one:

Run update first:

sudo yum update

Download the repo:

sudo rpm -ivh http://repo.zabbix.com/zabbix/4.2/rhel/6/x86_64/zabbix-agent-4.2.2-1.el6.x86_64.rpm

Install using the repository:

sudo yum install zabbix-agent -y

Now you need to configure the agent:

sudo vim /etc/zabbix/zabbix_agentd.conf

Change the following lines:

Line number 98:

Server=Your_Zabbix_server_ip

Line number 139:

ServerActive=Your_Zabbix_server_ip:10050

Line number 150

Hostname=hostaname_of_agent_server

[Line Numbers May Differ]

Save and exit from the vim editor.

Then start the zabbix agent:

sudo service zabbix-agent enablesudo service zabbix-agent start

How to configure AWS security groups for zabbix?

By default, all ports are kept open on security group for AWS EC2. System admins keep the ports blocked for security purpose. For a successful Host-Agent communication of Zabbix system it needs certain ports to be opened.

For zabbix server host

You need to open port 10051 to communicate with the agent host. The security group will look like below:

For zabbix Agent:

Zabbix Agent hosted server needs to keep the port 10050 open to communicate with zabbix server.

You are done with configuration!

How to test successful connection between Zabbix host and Zabbix agent?

How to Install Zabbix Agent on Amazon Linux

nc -v -z Zabbix_Server_IP 10051

It will show a connection successful message.

To test the connection from Zabbix Server to agent installed server:

nc -v -z zabbix_agent_server-IP 10050

If you wish to discuss more this article, just ping me at istiaque.islam@monstar-lab.com.bd

Visit our website to learn more about us:
www.monstar-lab.co.bd

Happy Monitoring!

--

--