Zabbix is one the best Open Source network monitoring tool for monitoring an infrastructure. It has many features to monitor services and hosts from low level to high level. So among its all features, we are going to discuss and setup its one the most important and useful feature to provision Zabbix Proxy. To implement Zabbix Proxy for centralized and distributed monitoring is good for your remote host monitoring. When all agents and proxies reports to one Zabbix server and all data is being collected at central location.
How it Works
Zabbix Proxies are useful when a server is is not able to communicate directly to the monitored machines. This is common when Organizations have to be monitored, or when there are some restrictions in a large corporate network. Once we had done with Zabbix Proxy setup then connections to the Zabbix Server come from the Proxy Server which will do all the monitoring on the behalf of Zabbix server.
Setting up Proxy Server
We will be using a separate Linux server with CentOS 7 as the base operating system with MySQL database server installed on it that will be used as a local database for Proxy server. So in this article we assume that you already had setup your Zabbix Server, if not you can follow our Zabbix Server Installation Tutorial.
Zabbix Proxy Installation Setup
Different options are available to install zabbix proxy by using Zabbix RPMs, Creating your own Repo or from the source.
So in this tutorial we will follow the installation process by using its available RPMs.
Configure the ZabbixZone package repository and GPG key
Let’s import Zabbix GPG key and its latest available repository by using the below commands.
Installing Zabbix Proxy
We have to create a separate user and group that will be used for zabbix running processes.
Let’s create a group and a user with name “zabbix” as:
Now run the zabbix proxy installation command with yum installer.
[[email protected] ~]# yum install zabbix-proxy-mysql.x86_64
After the installation process starts, press “Y” to confirm installation startup.
Install necessary packages
Now we install install the necessary server’s packages that we wish to install on the proxy server including zabbix server package in case if you want to monitor this as well.
Now, execute the following yum command to start installing packages for zabbix.
[[email protected] ~]# yum install mysql-server zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway
The executed command will ends up with installation of all the packages that we mentioned in the command as shown.
Database Setup for Zabbix Proxy
As we had done with installation of all prerequisite packages necessary for zabbix proxy, now we will setup its database using mysql. Proceeding to the database settings first check that your mysql server is up and you can login with your root password.
Creating new database
Once your mysql server is up and you are loged into it, create a new database for zabbix proxy.
mysql> create database zbx_proxy character set utf8;
Query OK, 1 row affected (0.00 sec)
In order to grant user level privileges on databases to zabbix user run the following command.
mysql> grant all privileges on zabbix.* to ‘zabbix’@’localhost’ identified by ‘zbx123’;
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Loading Zabbix Schema
Exit from the mysql database server and from the shell we nee to import zabbix schema into newly created database for zabbix proxy. Run the below commands to load zabbix schema from the zabbix database source for its latest version.
[[email protected] mysql]# pwd
The above command states that we are currently in mysql directory of zabbix source, here we run the command to import its schema into the newly created database for zabbix proxy.
Zabbix Proxy Configuration
We are going to configure zabbix proxy configurations now, to do so let’s open up the zabbix proxy conf file placed in “/etc/zabbix/” directory with your file editor.
[[email protected] ~]# vim /etc/zabbix/zabbix_proxy.conf
Now configure it with following options.
Put the IP of your Zabbix Server here, if its running on another machine.
Mention the hostname here that you like to configure it here.
Give the database name, its user and password, that we had created above in zabbix database proxy settings.
Now save the changes to the zabbix configurations file and close it with “wq!”.
Start Zabbix Proxy Services
Run the “zabbix_proxy” command to start its service and then confirm its process with “ps” or “netstat ” commands to confirm if its processes are running.
Here is the snapshot of all the running processes under zabbix_proxy on port “10051”.
You can also check the zabbix proxy logs by opening up its logs file zabbix_proxy.log created in “/var/log/zabbix/” directory.
[[email protected] ~]#cat /var/log/zabbix/zabbix_proxy.log
Here can see its logs about successfully services start up in below image.
Configure Zabbix Proxy on Master Server
Now we need to configure the zabbix proxy on the master server. Open its dashboard and expand the “Administration” options and click to “Proxies”, then click on the top right corner to “Create Proxy”.
Monitoring New Host with Zabbix Proxy
Zabbix Proxy has been setup and configured in Master Zabbix Server, now we can add different hosts that we need to be monitored via proxy server.
Adding Proxy Agent
Let’s install the zabbix agent on the host that you want to monitor through Zabbix Proxy and configure its configurations file with following options.
[[email protected]_agent ~]# vim /usr/local/etc/zabbix_agentd.conf
Now start zabbix agent services on and then add it on the master zabbix server as shown below.
Cheers! In this detailed article we learnt to setup stand alone zabbix proxy server on a Linux server with CentOS 7 operating system installed on it, with its configurations on master proxy server. We can add multiple zabbix agents on it that we want to monitor through zabbix proxy. Feel to write us in comments section if you face any issue during its setup.