Sunday, 22 May 2011

Install a monitoring Zabbix Server

Install the packages:
aptitude install zabbix-server-mysql zabbix-frontend-php
Set the php time zone:
vi /etc/php5/apache2/php.ini
  • search for date.timezone and set it to "Europe/Lisbon"
  • set "mbstring.func_overload" to 2
  • set post_max_size to 16M
  • set max_execution_time to 300
Restart apache
/etc/init.d/apache2 restart
SNMP Builder is a very useful add-on for Zabbix to help you to build custom SNMP based tamplates, to install-it follow the instructions on the following link:

Look for CISCO MIBs here ->

goto http://<ip_address>/zabbix

Log in using:


Setup Auto Discovery:

Template Linux:
there are several items in the Linux template that are not useful fore every server so I disable the following items and enable them only when needed:
  • Email (SMTP) server is running
  • FTP server is running
  • IMAP server is running
  • News (NNTP) server is running
  • Number of running processes zabbix_server
  • Number of running processes inetd
  • Number of running processes mysqld
  • POP3 server is running
Monitor Apache:

The Debian installation uses apache2 as the Apache process, so if you have a Debian based server farm, you should change your Number of running processes apache item to apache2. The SuSE apache process is named httpd2-prefork, so change the item, if needed. Maybe you need to clone the item, if this is the only server of this type.

Monitor SQUID from Zabbix:

However I had to configure the zabbix_agentd.conf a little bit differently:
# Squid
UserParameter=squid.http_requests,squidclient -h -p 80 mgr:info|grep 'Number of HTTP requests received:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.clients,squidclient -h -p 80 mgr:info|grep 'Number of clients accessing cache:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.icp_received,squidclient -h -p 80 mgr:info|grep 'Number of ICP messages received:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.icp_sent,squidclient -h -p 80 mgr:info|grep 'Number of ICP messages sent:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.icp_queued,squidclient -h -p 80 mgr:info|grep 'Number of queued ICP replies:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.htcp_received,squidclient -h -p 80 mgr:info|grep 'Number of HTCP messages received:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.htcp_sent,squidclient -h -p 80 mgr:info|grep 'Number of HTCP messages sent:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.req_fail_ratio,squidclient -h -p 80 mgr:info|grep 'Request failure ratio:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.avg_http_req_per_min,squidclient -h -p 80 mgr:info|grep 'Average HTTP requests per minute since start:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.avg_icp_msg_per_min,squidclient -h -p 80 mgr:info|grep 'Average ICP messages per minute since start:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.request_hit_ratio,squidclient -h -p 80 mgr:info|grep 'Hits as % of all requests:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.byte_hit_ratio,squidclient -h -p 80 mgr:info|grep 'Hits as % of bytes sent:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.request_mem_hit_ratio,squidclient -h -p 80 mgr:info|grep 'Memory hits as % of hit requests:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.request_disk_hit_ratio,squidclient -h -p 80 mgr:info|grep 'Disk hits as % of hit requests:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.servicetime_httpreq,squidclient -h -p 80 mgr:info|grep 'HTTP Requests (All):'|cut -d':' -f2|tr -s ' '|awk '{print $1}'
UserParameter=squid.process_mem,squidclient -h -p 80 mgr:info|grep 'Process Data Segment Size via sbrk'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.cpu_usage,squidclient -h -p 80 mgr:info|grep 'CPU Usage:'|cut -d':' -f2|tr -d '%'|tr -d ' \t'
UserParameter=squid.cache_size_disk,squidclient -h -p 80 mgr:info|grep 'Storage Swap size:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.cache_size_mem,squidclient -h -p 80 mgr:info|grep 'Storage Mem size:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.mean_obj_size,squidclient -h -p 80 mgr:info|grep 'Mean Object Size:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.filedescr_max,squidclient -h -p 80 mgr:info|grep 'Maximum number of file descriptors:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.filedescr_avail,squidclient -h -p 80 mgr:info|grep 'Available number of file descriptors:'|cut -d':' -f2|awk '{print $1}'
Monitor Postfix from Zabbix:

but use the script from

Download Zabbix SNMP template generator:
This is a very useful script to automatically generate templates for your network equipment.

Create calculated Items:[]=calculated#calculated_items

Advanced parcing of SNMP Values:

Install zabbix linux clients:
sudo aptitude install zabbix-agent
sudo dpkg-reconfigure zabbix-agent
Input the zabbix server IP address
Now edit the agent conf file:
vi /etc/zabbix/zabbix-agentd.conf
and change the hostname to the correct one

Restat the agent:
sudo /etc/init.d/zabbix-agent restart
For windows get the installer from: or from

Please check my posts about Zabbix Performance:
Simple zabbix tunning tips
Performance tuning mysql for zabbix

Possibly Related Posts

No comments:

Post a Comment