Installing Zabbix 3.2 on Debian Jessie
Zabbix is enterprise open source monitoring software for networks and applications, created by Alexei Vladishev. It is designed to monitor and track the status of various network services, servers, and other network hardware.
Zabbix uses MySQL, PostgreSQL, SQLite, Oracle or IBM DB2 to store data.[2] Its backend is written in C and the web frontend is written in PHP. Zabbix offers several monitoring options:
- Simple checks can verify the availability and responsiveness of standard services such as SMTP or HTTP without installing any software on the monitored host.
- A Zabbix agent can also be installed on UNIX and Windows hosts to monitor statistics such as CPU load, network utilization, disk space, etc.
- As an alternative to installing an agent on hosts, Zabbix includes support for monitoring via SNMP, TCP and ICMP checks, as well as over IPMI, JMX, SSH, Telnet and using custom parameters. Zabbix supports a variety of near-real-time notification mechanisms, including XMPP.
The following guide will help you setup and configure Zabbix 3.2 on Debian Jessie
Add the repository
wget http://repo.zabbix.com/zabbix/3.2/debian/pool/main/z/zabbix-release/zabbix-release_3.2-1+jessie_all.deb
dpkg -i zabbix-release_3.2-1+jessie_all.deb
apt-get update
Install Packages
apt-get install zabbix-server-mysql zabbix-frontend-php
Initialize database user with a password 12345(please change the password)
Then create the zabbix database and zabbixuser
shell> mysql -uroot -p<root_password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;
Then import initial schema and data. You will be prompted to enter your newly created password.
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Database configuration for Zabbix server
Edit server host, name, user and password in zabbix_server.conf as follows, where DBPassword is the password you've set creating initial database::
nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>
Starting Zabbix server process
Now you may start Zabbix server process and make it start at system boot
service zabbix-server start
update-rc.d zabbix-server enable
PHP configuration for Zabbix frontend
Apache configuration file for Zabbix frontend is located in /etc/zabbix/apache.conf. Some PHP settings are already configured. But it's necessary to uncomment the “date.timezone” setting and set the right timezone for you.
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
After that you need to restart Apache web server:
service apache2 restart
Installing using Docker Containers
Run zabbix mysql container using volumes option so that the database is saved on the host
docker run -d -v /var/lib/mysql:/var/lib/mysql --name zabbix-db --env="MARIADB_USER=zabbix" --env="MARIADB_PASS=zabbix" -p 3306:3306 monitoringartist/zabbix-db-mariadb
Then run the zabbix container which connect to the database container
docker run -d --name zabbix -p 80:80 -p 10051:10051 -v /etc/localtime:/etc/localtime:ro --link zabbix-db:zabbix.db --env="ZS_DBHost=zabbix.db" --env="ZS_DBUser=zabbix" --env="ZS_DBPassword=zabbix" --env="XXL_zapix=true" --env="XXL_grapher=true" monitoringartist/zabbix-xxl:latest
You can then simply do database backups and restores using the following commands from host
Backup
mysqldump -uzabbix -h172.17.0.1 -pzabbix zabbix > /srv/zabbix_db_dump.sql
Restore
mysql -uzabbix -h172.17.0.1 -pzabbix zabbix < /srv/zabbix_db_dump.sql