Skip to main content

Howto Configure Zabbix Proxy for External Monitoring on CentOS 7

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.

          [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 -y
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.
[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 -p
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 zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)
Assigning Privileges
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.
[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.conf
Now configure it with following options.
Put the IP of your Zabbix Server here, if its running on another machine.
#Server=127.0.0.1
Server=172.25.10.181
Mention the hostname here that you like to configure it here.
#Hostname=Zabbix proxy
Hostname=zbx_proxy
Give the database name, its user and password, that we had created above in zabbix database proxy settings.
#DBName=zabbix_proxy
DBName=zabbix
# DBUser=
DBUser=zabbix
# DBPassword=
DBPassword=zbx123
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.
[root@centos-007 ~]# zabbix_proxy
[root@centos-007 ~]# netstat -anp | grep zabbix_proxy
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.
[root@centos-007 ~]#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".

Comments

Popular posts from this blog

How to remove zabbix-agent from Ubuntu 16.04 (Xenial Xerus)

Uninstall zabbix-agent To remove just zabbix-agent package itself from Ubuntu 16.04 (Xenial Xerus) execute on terminal: sudo apt-get remove zabbix-agent Uninstall zabbix-agent and it's dependent packages To remove the zabbix-agent package and any other dependant package which are no longer needed from Ubuntu Xenial. sudo apt-get remove --auto-remove zabbix-agent Purging zabbix-agent If you also want to delete configuration and/or data files of zabbix-agent from Ubuntu Xenial then this will work: sudo apt-get purge zabbix-agent To delete configuration and/or data files of zabbix-agent and it's dependencies from Ubuntu Xenial then execute: sudo apt-get purge --auto-remove zabbix-agent

Install Zabbix Agent on Suse Linux and Configure

Install taken from Suse –  http://software.opensuse.org/download/package?project=server:monitoring&package=zabbix-agent For SLE 12 SP1 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_12_SP1/server:monitoring.repo zypper refresh zypper install zabbix-agent For SLE 12 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_12/server:monitoring.repo zypper refresh zypper install zabbix-agent For SLE 11 SP4 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_11_SP4/server:monitoring.repo zypper refresh zypper install zabbix-agent For SLE 11 SP3 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_11_SP3/server:monitoring.repo zypper refresh zypper install zabbix-agent To configure the agent – Instructions taken from – https://www.zabbix.org/wiki

Zabbix alert Notification with Telegram

Zabbix Notifications with graphs in Telegram. Features  Graphs based on latest data are sent directly to your messenger  You can send messages both in private and group chats  Channels support  Saves chatid as a temporary file  Simple markdown and HTML are supported  Emoji in messages First of all : Nedd to install python (>3) on Cent os  # yum -y install python-pip # yum install -y https://centos7.iuscommunity.org/ius-release.rpm #  yum install -y python34u python34u-libs python34u-devel python34u-pi # yum -y install python-pip You need to install the  requests  module for python, this is required for operation! # pip install requests Put  zbxtg.py  in your  AlertScriptsPath  directory, the path is set inside your zabbix_server.conf (once confirm by zabbix server conf file ) Link to download ZBXTG.PY file  https://drive.google.com/open?id=0BxB8j19aCMZ8dFl1aHVuLVJyRjQ # cp zbxtg.py /usr/local/share/zabbix/alertscripts/ Create