Installing Zabbix Proxy

Zabbix is my current favourite tool for monitoring an infrastructure, from a few services to many hundreds.  Have found one of the most useful features of the Zabbix architecture is its provision for Zabbix proxies.

A Zabbix proxy gathers the monitoring data, stores it in its local database and then forwards it to the central collection server. Example use if you have a set of servers inside a firewall that need to be monitored then setup a Zabbix proxy inside the firewall to collect the data from that set.  The proxy can then securely forwarded the collected data onto the central external monitoring server.

One major benefit it by having locally collected data, if the WAN connected between proxy and server became unavailable, data is not lost.

tip – setup a local agent on the proxy server to check for it’s availability/usage.

 

Zabbix Proxy configuration

The documentation of proxy setup is here:

http://www.zabbix.com/documentation/2.0/manual/distributed_monitoring/proxies

To setup a proxy server for Zabbix, followed these steps

  1. create my Centos VM
  2. using EPEL, installed  the package containing the proxy with mysql :
  3. The proxy server needs to connect to a database – this should not be the same as the one used by the Zabbix server.  Instead, use a local one, here i’m using mysql.
yum install zabbix20-proxy-mysql

start mysql and connect.
# mysql -uroot
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> exit

it will be necessary to load in the database schema, so change to the directory containing the downloaded sources and :

# mysql -uroot zabbix < schema.sql

As we are using mysql, now we need to amend the configuration file – zabbix_proxy.conf – to set the connections for the new database.

change sections to suit the local installation :

### Option: DBName
# Database name.
DBName=zabbix
### Option: DBUser
# Database user. Ignored for SQLite.
 DBUser=zabbix
### Option: DBPassword
# Database password. Ignored for SQLite.
DBPassword=zabbix
### Option: DBSocket
# Path to MySQL socket.
DBSocket=/var/lib/mysql/mysql.sock
# Option: DBPort
# DBPort=3306
  1. now start the proxy process
  2. [root@zabbixproxy ~]# service zabbix-proxy start
    Starting Zabbix proxy: [ OK ]

check the proxy log file for errors:

all being well, should see example:

20304:20130605:102118.705 Starting Zabbix Proxy (active) [zabbixproxy]. Zabbix 2.0.6 (revision 35158).
 20304:20130605:102118.706 **** Enabled features ****
 20304:20130605:102118.706 SNMP monitoring: YES
 20304:20130605:102118.706 IPMI monitoring: YES
 20304:20130605:102118.706 WEB monitoring: YES
 20304:20130605:102118.706 ODBC: YES
 20304:20130605:102118.706 SSH2 support: YES
 20304:20130605:102118.706 IPv6 support: YES
 20304:20130605:102118.706 **************************
 20308:20130605:102118.724 proxy #3 started [data sender #1]
 20307:20130605:102118.725 proxy #2 started [heartbeat sender #1]
 20315:20130605:102118.729 proxy #10 started [trapper #1]
  1. Next we’ll configure the central monitoring server to recognize the proxy.
    1. Login to the web interface and go to Administration -> DM.
    2. Click the Create Proxy button.
    3. On the new proxy form, enter the hostname of the proxy into the “Proxy name” field.
    4. Click the Save button
  2. Finally, on install Zabbix Agents as you would normally on the servers to be monitored from the proxy. In the Zabbix web interface, when defining a host monitored via the proxy, set the “Monitored by proxy” field on the host configuration form.