Installing a proxy

In this recipe, we will show you how to install a proxy in your network. The installation of a proxy is very straightforward as you will see. However, monitoring and configuring the proxy can be more complicated. For this reason, we have split up installation and the different types of configuring a proxy in this chapter.

Getting ready

What we need for this recipe is of course, our Zabbix server with super administrator rights. We need an extra machine to install our proxy.

How to do it…

As the proxy is a lightweight version of the Zabbix server, the installation procedure is almost exactly the same.

  1. First we add the Zabbix repository to our server:
    rpm -ivh
    http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix- release-2.4-1.el6.noarch.rpm
    
  2. Next step is to install our proxy. We will make use of a SQLite database:
    yum install zabbix-proxy-sqlite3
    
  3. Make sure the proxy will start at our next reboot:
    chkconfig zabbix-proxy on
    
  4. Open the correct port in the firewall. Standardly, this is port 10051, the same port that we use for the Zabbix trapper. Edit the /etc/sysconfig/iptables file and add the following line under the line with the –dport 22 option:
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
    
  5. Restart the firewall:
    service iptables restart
    
  6. Edit the proxy configuration by editing the zabbix_proxy.conf file.
    vi /etc/zabbix/zabbix_proxy.conf
    Change the following parameters
    Server=<ip of your zabbix server>
    Hostname=<name of your proxy>
    DBName=/home/zabbix/zabbix.db
  7. Next step is to create the Zabbix home directory for our database:
    mkdir /home/zabbix
    chmod 750 /home/zabbix
    chown zabbix:zabbix /home/zabbix
    
  8. Now we can start our Zabbix proxy:
    service zabbix-proxy start
    
  9. Make sure the Zabbix proxy is running by looking at the log file:
    tail /var/log/zabbix/zabbix_proxy.log
    
  10. In our Zabbix server, we now have to add our proxy. Go to Administration | Proxies and click on Create on the right of the screen. Fill in your Proxy name and click on Add button. There is no need to change anything else as yet:
    How to do it…
  11. Now go back to Administration | Proxies and after some time, you will see that the Zabbix server has some communication with the proxy.
    How to do it…

How it works…

The Zabbix proxy is basically a Zabbix server without a graphical interface with the difference that the proxy will only collect the data and send it to the Zabbix server for processing. So when we install a proxy, we need a database just like we have on the server. In this setup, we made use of a SQLite database and as you have noticed we did not have to install anything. When you make use of a SQLite database, the proxy will create the database and do all configuration work for you.

It is possible to use any database that can be used for the Zabbix server. However, we then need to change the zabbix_proxy.conf file and fill in the correct username and password and tell the proxy to use a MySQLdb, PostgreSQL, or Oracle database.

Another thing that is important when using a real database is to only upload the schema.sql file and never the images.sql, and data.sql files!

There's more…

To monitor large or distributed networks, you can make use of Zabbix proxies. A proxy will then be responsible for a certain number of hosts. The proxy will be the only one talking to the hosts and will forward all the data to the Zabbix server.

The use of proxies is always useful when the Zabbix server cannot reach the hosts due to routing and or firewalls or for hosts in DMZ. The use of a proxy can also be used to monitor resources from outside your network.

The proxy will also reduce database load on the server when you have many hosts to monitor. Since the proxy transmits the data collected in a large block, the database needs only a few large inserts and updates processed. This produces less load than many small operations.

The combination with so-called reverse tunneling (SSH, OpenVPN) allows you to monitor with proxies on networks that can be accessed only through a connection with dynamic IP address.

A proxy can collect data on behalf of the Zabbix server. For this reason, a proxy must be compiled with the same options as the server. When you monitor, for instance, host via SNMP, then the proxy must be built with SNMP support. When you run external scripts, those scripts must be installed on the proxy instead of Zabbix server.

If you use a proxy, remember the following:

  • In the configuration of the agent, you must use the proxy address as server.
  • If you make use of the zabbix_sender option, then you must send it to the proxy.
  • When you monitor a host by proxy, all checks are performed by the proxy. It is not possible to run individual checks from the server.
  • If you are using external scripts on the server, all scripts must also be stored on the proxy.
  • Configurations that you make on the server through the web GUI reach the proxies with delay.
  • Zabbix server and proxy should be the same version. Expect problems if the proxy has a different version than the server.
  • Zabbix server and proxy can use different databases. The data exchange is not at the database level. You can use, for example, PostgreSQL for the Zabbix server and SQLite for proxies.
  • A SQLite database should be able to handle about + / - 50 hosts; it depends on how many items you monitor and the interval at which you check them and on the hardware. It should even be possible to archive about 500 VPS.
  • The requirements for a proxy are very low and could even run on embedded hardware. (Have a look on the Zabbix forum for some projects):
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset