- MariaDB (Mysql)
- Nginx
- Php5-fpm
- Zabbix 2.2.*
All Stock Packages no Extra Repositories is needed. It Awesome!
DIY Ubuntu Server 14.04, it extremely easy. I mount /var on seperate hard disk for Mysql perfomance. MariaDB have many advantage than Mysql (belong to Oracle already).
hostname zabbix.mydomain.vn && echo 'zabbix.mydomain.vn ' > /etc/hostname
Note:
- datetime: sync your server to your NTP server.
- Notice your mysql password
sudo apt-get update && apt-get -y dist-upgrade
sudo apt-get install mariadb-server nginx php5-fpm php5-mysql snmp libnet-snmp-perl snmp-mibs-downloader
sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent
MariaDB Mysql
create zabbix user, zabbix database, grant privileges for zabbix user on database zabbix.
mysql -u root -p
Enter password: your root password at MariaDB installation
create user 'zabbix'@'localhost' identified by 'Zabbix_DB_Passwd';
create database zabbix;
grant all privileges on zabbix.* to 'zabbix'@'localhost';
flush privileges;
exit;
Php5-fpm
Edit /etc/php5/fpm/php.ini for Zabbix
[PHP]
.....
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
......
[Date]
date.timezone = Asia/Ho_Chi_Minh
Edit [www] pool /etc/php5/fpm/pool.d/www.conf
[www]
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
#### It depend on my server hardware, you can leave it as default ^^ #####
pm = dynamic
pm.max_children = 24
pm.start_servers = 8
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 50000
chdir = /
Restart php5-fpm
sudo service php5-fpm restart
Nginx
In my case, this box is dedicated for Zabbix, so default site will be zabbix, Php web app root dir is in /usr/share/zabbix.
Edit /etc/nginx/sites-available/default
server {
listen 80 default_server;
root /usr/share/zabbix;
index index.php index.html index.htm;
server_name zabbix.mydomain.vn;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Restart Nginx
sudo service nginx restart
Zabbix-server
Init Zabbix database:
cd /usr/share/zabbix-server-mysql/
mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql
sudo cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
Edit /etc/zabbix/zabbix.conf.php
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'Zabbix_DB_Passwd';
$ZBX_SERVER = 'zabbix.mydomain.vn';
$ZBX_SERVER_PORT = '10051';
Enable Zabbix monster in /etc/default/zabbix-server
START=yes
CONFIG_FILE="/etc/zabbix/zabbix_server.conf"
Edit /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix-server/zabbix_server.log
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword=Zabbix_DB_Passwd
AlertScriptsPath=/etc/zabbix/alert.d/
FpingLocation=/usr/bin/fping
Start up Zabbix monster
service zabbix-sever restart
Zabbix-agent
Hostname is very important. It must be same with Hostname in Host Configuration in Zabbix Dashboard.I disable ServerActive => My Zabbix agent will run in Passive mode (Server directive). The Server will open a port and then visit his Agent port 10050 and ask for his money :D
Edit /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix-agent/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1 #Address of Zabbix Server
Hostname=zabbix.ssis.edu.vn #FQDN of monitored host
Restart Zabbix-agent
sudo service zabbix-agent restart
Zabbix Dashboard
Go to Zabbix web dashboard: http://zabbix.mydomain.vnDefaut username: Admin
Default password: zabbix
Add host monitoring will be on next Part
Troubleshooting
MariaDB: /var/log/mysql/error.log
Nginx: /var/log/nginx/error.log
Php5-fpm: /var/log/php5-fpm.log
Zabbix-server: /var/log/zabbix-server/zabbix_server.log
More verbosity? Turn on DebugLevel=4 at /etc/zabbix/zabbix_server.conf
I am truly pleased to read this website posts which carries lots of helpful data, thanks for providing these kinds of statistics.
ReplyDeleteHistorical Options Data
This comment has been removed by the author.
ReplyDeletewhen I install zabbix-frontend with command : sudo apt-get install zabbix-frontend-php, it show the error:
ReplyDeleteReading package lists... Done
Building dependency tree
Reading state information... Done
zabbix-frontend-php is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 231 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up zabbix-frontend-php (1:2.4.4-1+trusty) ...
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
env: apache2ctl: No such file or directory
invoke-rc.d: initscript apache2, action "restart" failed.
dpkg: error processing package zabbix-frontend-php (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
zabbix-frontend-php
E: Sub-process /usr/bin/dpkg returned an error code (1)
env: ubuntu 14.04; nginx and zabbix 2.4.
Do you have any suggestion ?
I also followed the Kodai Terashima's comment in https://support.zabbix.com/browse/ZBX-6941 but it is no luck.
Hi Linh,
Deletemake sure you remove Apache if you don't want it mess up with your Nginx