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:
http://www.zabbix.com/wiki/howto/monitor/snmp/snmp_builder

Look for CISCO MIBs here -> http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en

goto http://<ip_address>/zabbix

Log in using:

admin/zabbix

Setup Auto Discovery:
http://www.zabbix.com/documentation/1.8/manual/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:
http://www.zabbix.com/wiki/howto/monitor/web/squid

However I had to configure the zabbix_agentd.conf a little bit differently:
# Squid
UserParameter=squid.http_requests,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of HTTP requests received:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.clients,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of clients accessing cache:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.icp_received,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of ICP messages received:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.icp_sent,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of ICP messages sent:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.icp_queued,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of queued ICP replies:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.htcp_received,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of HTCP messages received:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.htcp_sent,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Number of HTCP messages sent:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.req_fail_ratio,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Request failure ratio:'|cut -d':' -f2| tr -d ' \t'
UserParameter=squid.avg_http_req_per_min,squidclient -h 192.168.100.19 -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 192.168.100.19 -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 192.168.100.19 -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 192.168.100.19 -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 192.168.100.19 -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 192.168.100.19 -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 192.168.100.19 -p 80 mgr:info|grep 'HTTP Requests (All):'|cut -d':' -f2|tr -s ' '|awk '{print $1}'
UserParameter=squid.process_mem,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Process Data Segment Size via sbrk'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.cpu_usage,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'CPU Usage:'|cut -d':' -f2|tr -d '%'|tr -d ' \t'
UserParameter=squid.cache_size_disk,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Storage Swap size:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.cache_size_mem,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Storage Mem size:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.mean_obj_size,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Mean Object Size:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.filedescr_max,squidclient -h 192.168.100.19 -p 80 mgr:info|grep 'Maximum number of file descriptors:'|cut -d':' -f2|awk '{print $1}'
UserParameter=squid.filedescr_avail,squidclient -h 192.168.100.19 -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.
http://www.zabbix.com/wiki/scripts/gentemplate.pl

Create calculated Items:
http://www.zabbix.com/documentation/1.8/manual/config/items?s[]=calculated#calculated_items

Advanced parcing of SNMP Values:
http://www.zabbix.com/forum/showthread.php?t=19343

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:
http://www.suiviperf.com/zabbix/ or from http://www.zabbix.com/download.php

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

Possibly Related Posts

No comments:

Post a Comment