ZTC (Zabbix Templates Collection) – the simple way to use the templates of zabbix – Linux, PostgreSQL, Slony, Nginx, Apache2, Mongo etc.

These the instruction are correct for the version of package 12.0.

Now, we describe step by step all the process in the very simple form:

1. Download the archive tar.gz ztc-12.01.1.tar.gz and save to any the temporary directory, for example – /tmp. (CLIENT SIDE!!)

2. Go to /tmp, get the privileges of root and extract the archive (CLIENT SIDE!!).

root@localhost:~# cd /tmp
root@localhost:/tmp# tar xvzf ztc-12.01.1.tar.gz 2>&1 > /dev/null
root@localhost:/tmp# chown -R root.root ztc-12.01.1
root@localhost:/tmp#

3. Go to the zabbix config directory and copy the configuration files for zabbix agentd (CLIENT SIDE!!):

root@localhost:/tmp# cd /etc/zabbix/zabbix_agentd.conf.d/
root@localhost:/etc/zabbix/zabbix_agentd.conf.d# cp -a /tmp/ztc-12.01.1/conf/zabbix-agent.d/* .
root@localhost:/etc/zabbix/zabbix_agentd.conf.d# ll
total 60
drwxr-xr-x 2 root root 4096 Nov  5 15:32 ./
drwxr-xr-x 3 root root 4096 Oct 20 22:31 ../
-rw-r--r-- 1 root root 1375 Jan 26  2012 apache.conf
-rw-r--r-- 1 root root  161 Jan 26  2012 common.conf
-rw-r--r-- 1 root root   70 Jun 17  2011 hw.conf
-rw-r--r-- 1 root root 1014 Jan 26  2012 jboss.conf
-rw-r--r-- 1 root root 1423 Jun 17  2011 linux.conf
-rw-rw-r-- 1 root root 1389 Mar  5  2012 mongo.conf
-rw-r--r-- 1 root root  210 Jun 17  2011 mysql.conf
-rw-r--r-- 1 root root   77 Jun 17  2011 nfs.conf
-rw-r--r-- 1 root root  852 Jan 26  2012 nginx.conf
-rw-rw-r-- 1 root root 2477 Mar  5  2012 pgsql.conf
-rw-r--r-- 1 root root  313 Jan 26  2012 php.conf
-rw-r--r-- 1 root root   91 Jun 17  2011 slony.conf
-rw-r--r-- 1 root root  907 Jan 26  2012 terracotta.conf
root@localhost:/etc/zabbix/zabbix_agentd.conf.d#

4. Make the directory for the executable and configuration files and copy their (CLIENT SIDE!!) and the python’s files:


root@localhost:/etc/zabbix/zabbix_agentd.conf.d# mkdir -p /opt/ztc/bin/
root@localhost:/etc/zabbix/zabbix_agentd.conf.d# cd /opt/ztc/bin/
root@localhost:/opt/ztc/bin# cp -a /tmp/ztc-12.01.1/src/*.py .
root@localhost:/opt/ztc/bin#

root@localhost:~# mkdir -p /etc/ztc
root@localhost:~# cd /etc/ztc/
root@localhost:/etc/ztc# cp -a /tmp/ztc-12.01.1/conf/etc/*.conf .
root@localhost:/etc/ztc# ls
apache.conf         mongo.conf  net.conf  nginx.conf  pgsql.conf    slony.conf
hw_raid_3ware.conf  mysql.conf  nfs.conf  ntp.conf    php-fpm.conf  terracotta.conf
root@localhost:/etc/ztc#

root@localhost:/opt/ztc/bin# cd /usr/lib/python2.7/dist-packages/
root@localhost:/usr/lib/python2.7/dist-packages# cp -a /tmp/ztc-12.01.1/src/ztc .
root@localhost:/usr/lib/python2.7/dist-packages# python
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ztc
>>>
root@localhost:/usr/lib/python2.7/dist-packages# cd /var/log
root@localhost:/var/log# ln -s zabbix-agent zabbix

5. Open /etc/sudoers and add the row:

zabbix ALL=(ALL) NOPASSWD: /opt/ztc/bin/apache_reqtime.py *

6. Now we can check zabbix keys, for example apache:

root@localhost:/etc/zabbix/zabbix_agentd.conf.d# zabbix_agentd -p|egrep apache
apache.ping                                   [t|0.002961]
apache.accesses                               [t|22606]
apache.traffic                                [t|20505600]
apache.workers.busy                           [t|1]
apache.workers.closingconn                    [t|0]
apache.workers.dns                            [t|0]
apache.workers.finishing                      [t|0]
apache.workers.idle                           [t|9]
apache.workers.idlecleanup                    [t|0]
apache.workers.keepalive                      [t|0]
apache.workers.logging                        [t|0]
apache.workers.openslot                       [t|246]
apache.workers.reading                        [t|0]
apache.workers.starting                       [t|0]
apache.workers.writing                        [t|1]
apache.workers.reqtime[]                      [t|0]
root@localhost:/etc/zabbix/zabbix_agentd.conf.d# 

7. Last the step, just add the template for our keys to the zabbix server.

Scroll to top