Linux : Monitoring And supervision with Zabbix

Here is some notes of my own Zabbix monitoring system installation (debian based). It has been done since a while now, but I never took the time to finalize this post. However, it can still be usefull as not much (nothing ?) has changed regarding activities to do…

Base Install

Server Part

Snmp is of course only usefull if you have things that support it (my administrable switch does)…

Then follow instruction on /usr/share/doc/zabbix-server-mysql/README.Debian

In /etc/zabbix/zabbix_server.conf,

  • I comment out “LogFile” to use Syslog as I centralise all my logs with rsyslog
  • I set Housekeeping to 24 (small home network with less than 10 servers)
  • LogSlowQuery=10

Enable zabbix-server in /etc/default/zabbix-server and launch it:

Make the admin console available through an alias in apache and restrict access to some IP addresses (vhost should work too) :

Put this in sites-available instead (I prefer that over the conf directory, then activate the site (either a2ensite or simple ln -s) and finaly restart apache (apachectl graceful).

Then, go to https://<server>/zabbix and follow the instructions.
At the end of the procedure, download and copy the generated configuration file to /etc/zabbix and set restrictive permission on it (db password in clear text inside) :

Be careful: you may need to increase the number of MySQL connections (max_connection parameter) if you already have other services that use it (zabbix server + Php front-end eat up at least 10 connections for a single user).

Also, mysqltunner can be very usefull to check MySQL settings.

Client Part (agent)

If all is up and running, zabbix-agent must be installed on all server that need to be monitored (apt-get install zabbix-agent). Then :

  • set hostname
  • set zabbix server ip
  • optionally comment out LogFile to use syslog (rsyslog in my case)
  • update /etc/hosts.allow (eg: zabbix_agentd:<zabbix server ip>)

Custom Monitoring

HTTPS Urls

if monitoring of https services fail, change the standard item from “net.tcp.service[https]” to “net.tcp.service[tcp,,443]”

Apache

You can find great bash scripts to monitor apache variables here : https://www.zabbix.org/wiki/Docs/howto/apache_monitoring_script

copy them on /usr/share/zabbix-scripts/ and give proper permissions

Nginx

Example can be found here : http://www.badllama.com/content/monitor-nginx-zabbix

If you want  max supported connection on your screens, add the following “userparameter” :

In case it may help, my own Nginx template : zbx_export_templates

MySQL

see https://www.zabbix.com/forum/showthread.php?t=41659

Create a user for zabbix that is allowed to check MySQL processes. For example :

Then protect the file : owned by the user and group your zabbix agent is running on behalf of and proper chmod :

You can also set a home dir for zabbix user, and set user and password in ~/.my.cnf

Samba

See : www.zabbix.com/forum/showthread.php?t=1995

Weekly and monthly Screen summary by e-mail

You can find a nice Perl script that send an e-mail with all of your favorites Zabbix screen here : www.zabbix.com/forum/showthread.php?t=20312

To make it work as, for example, /usr/share/zabbix-scripts/graphreport.pl you need the following :

You need also to adapt parameters at the begening of the file regarding Zabbix user and database

In addition, if you are using Zabbix 2.2.1,  change the line 62 (“$cmglogin..”.) by :

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.