Installing Zabbix GUI on Debian Wheezy (with dotdeb, MySQL and lighttpd)
But Why?
Everybody knows how important it is to monitor your servers, so you know what is going on at all times of the day. This also applies when when you want to have time of with friends and family. Everybody knows this, but it can be hard to make happen for yourself.Enter Zabbix!
Yes, there are alternatives like Cacti and probably other good monitoring systems, but while Zabbix is ugly as shit, it also is very powerful, easy to setup (sort of) and widely used.
How does it work?
Zabbix is very modular. There are 3 parts that make up the system; Server, GUI and Agent(s). I assume that you want to host the GUI on the same machine as the Server. This means that the finished setup could look something like this:Environment
Before we get started, we need to make sure some things are setup correctly. First of we need to add the dotdeb main repository to your sources.list . Add these two lines to your/etc/apt/sources.list
file (you can also choose a mirror near you):deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
curl http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -
sudo apt-get update
Installing Zabbix Server
Zabbix Server can be installed with support for either MySQL or PostgreSQL. I assume that you already have a running MySQL server:sudo aptitude install zabbix-server-mysql
/etc/zabbix/zabbix_server.conf
:sudo nano /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=<secret password>
mysql -e "CREATE DATABASE zabbix"
zcat /usr/share/zabbix-server-mysql/schema.sql.gz |mysql zabbix
zcat /usr/share/zabbix-server-mysql/images.sql.gz |mysql zabbix
zcat /usr/share/zabbix-server-mysql/data.sql.gz |mysql zabbix
/etc/default/zabbix-server
:sudo nano /etc/default/zabbix-server
START
option:
START=yes
Now we are ready to start the Zabbix server:
sudo service zabbix-server start
netstat -ln |grep 10051
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN
tcp6 0 0 :::10051 :::* LISTEN
Setting up the Zabbix GUI/Web interface
I assume that you already have PHP and lighttpd installed and working on the server.Start by install the Zabbix frontend package:
sudo aptitude install zabbix-frontend-php
php.ini
:sudo nano /etc/php5/cgi/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = UTC
sudo nano /etc/zabbix/zabbix.conf.php
<?php
global $DB;
$DB["TYPE"] = 'MYSQL';
$DB["SERVER"] = 'localhost';
$DB["PORT"] = 3306;
$DB["DATABASE"] = 'zabbix';
$DB["USER"] = 'zabbix';
$DB["PASSWORD"] = '<secret password>';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = 10051;
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>
<secret password>
with a working one.Once this is done, it's time to add the Zabbix webroot to the lighttpd vhost config file:
sudo nano /etc/lighttpd/conf-enabled/10-simple-vhost.conf
$HTTP["host"] =~ "^zabbix-srv.example.com" {
server.document-root = "/var/www/"
alias.url += (
"/zabbix/" => "/usr/share/zabbix/"
)
}
sudo service lighttpd restart
https://zabbix-srv.example.com/zabbix/
The default username/password is:
admin/zabbix
Nhận xét
Đăng nhận xét