Chuyển đến nội dung chính

Installing Zabbix GUI on Debian Wheezy (with dotdeb, MySQL and lighttpd)


Swift installation process of how to get the Zabbix GUI up and running on Debian Wheezy


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:
Zabbix network secured through SSH tunnels

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
and install the GnuPG key in APT:
curl http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -
Then update the package cache:
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
Once installed, edit /etc/zabbix/zabbix_server.conf:
sudo nano /etc/zabbix/zabbix_server.conf
and add the following changes:
DBName=zabbix
DBUser=zabbix
DBPassword=<secret password>
Create the database:
mysql -e "CREATE DATABASE zabbix"
and install the tables and initial data:
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
To make the Zabbix server start in Debian, edit /etc/default/zabbix-server:
sudo nano /etc/default/zabbix-server
and change the START option: START=yes
Now we are ready to start the Zabbix server:
sudo service zabbix-server start
The server should now respond to requests on port 10051. You can check this by running the following command:
netstat -ln |grep 10051
The resonse should be something like this:
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
Zabbix is very picky with the settings of PHP, so edit php.ini:
sudo nano /etc/php5/cgi/php.ini
and make sure the values are matched. If in doubt, just wait. Zabbix will inform you of any warnings once it comes online.
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = UTC
Create a config file:
sudo nano /etc/zabbix/zabbix.conf.php
And insert the following:
<?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;
?>
Make sure to replace the <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
Insert the following at the end of the file:
$HTTP["host"] =~ "^zabbix-srv.example.com" {
    server.document-root = "/var/www/"
    alias.url += (
        "/zabbix/" => "/usr/share/zabbix/"
    )
}
This it. Restart lighttpd:
sudo service lighttpd restart
and visit the Zabbix web interface:
https://zabbix-srv.example.com/zabbix/
The default username/password is: admin/zabbix

Nhận xét

Bài đăng phổ biến từ blog này

CLEANING UP THE ZABBIX DATABASE

Configuring DHCP Relay service on the FortiGate unit

Stuxnet Trojan - Memory Forensics with Volatility | Part I