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.
[root@centos-007 ~] yum update -y
Let’s import Zabbix GPG key and its latest available repository by using the below commands.
Installing Zabbix Proxy
Now run the zabbix proxy installation command with yum installer.
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.
[root@centos-007 ~]#systemctl enable mysqld
The executed command will ends up with installation of all the packages that we mentioned in the command as shown.
[root@centos-007 ~]# mysql_secure_installation
change password, then type yes for four times.
Once your mysql server is up and you are loged into it, create a new database for zabbix proxy.
In order to grant user level privileges on databases to zabbix user run the following command.
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.
Put the IP of your Zabbix Server here, if its running on another machine.
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.
You can also check the zabbix proxy logs by opening up its logs file zabbix_proxy.log created in "/var/log/zabbix/" directory.
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.[root@centos-007 ~] yum update -y
Let’s import Zabbix GPG key and its latest available repository by using the below commands.
[root@centos-007 ~]# rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
[root@centos-007 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
Installing Zabbix Proxy
Now run the zabbix proxy installation command with yum installer.
[root@centos-007 ~]# yum install zabbix-proxy-mysql.x86_64 -yAfter 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.
[root@centos-007 ~]# yum install mysql-server zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway[root@centos-007 ~]#systemctl start mysqld
[root@centos-007 ~]#systemctl enable mysqld
The executed command will ends up with installation of all the packages that we mentioned in the command as shown.
[root@centos-007 ~]# mysql_secure_installation
change password, then type yes for four times.
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.[root@centos-007 ~]# mysql -u root -pCreating new database
Once your mysql server is up and you are loged into it, create a new database for zabbix proxy.
mysql> create database zabbix character set utf8;Assigning Privileges
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';Loading Zabbix Schema
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
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.
[root@centos-007 mysql]#
cd /usr/share/doc/zabbix-server-mysql-3.x.x/
gunzip create.sql.gz
mysql -u root -p zabbix_db < create.sql
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.[root@centos-007 ~]# vim /etc/zabbix/zabbix_proxy.confNow configure it with following options.
Put the IP of your Zabbix Server here, if its running on another machine.
#Server=127.0.0.1Mention the hostname here that you like to configure it here.
Server=172.25.10.181
#Hostname=Zabbix proxyGive the database name, its user and password, that we had created above in zabbix database proxy settings.
Hostname=zbx_proxy
#DBName=zabbix_proxy
DBName=zabbix
# DBUser=
DBUser=zabbix
# DBPassword=Now save the changes to the zabbix configurations file and close it with "wq!".
DBPassword=zbx123
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.
[root@centos-007 ~]# zabbix_proxyHere is the snapshot of all the running processes under zabbix_proxy on port "10051".
[root@centos-007 ~]# netstat -anp | grep zabbix_proxy
You can also check the zabbix proxy logs by opening up its logs file zabbix_proxy.log created in "/var/log/zabbix/" directory.
[root@centos-007 ~]#cat /var/log/zabbix/zabbix_proxy.logHere can see its logs about successfully services start up in below image.
Comments
Post a Comment