如下步驟,參考了 zabbix官方手冊php
在搭建步驟以前,仍是整理一下本次的監控需求。mysql
以上,身爲主流監控工具的Zabbix徹底能夠知足。並且,有良好的擴展性,能夠知足日益增加的需求。linux
更新系統源
執行 sudo vi /etc/apt/sources.list,修改成:web
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
sudo vim /etc/zabbix/zabbix_server.conf
修改相關
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#非必需,但推薦StartDiscoverers=5sql
mysql -u root -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';數據庫
mysql> flush privileges;apache
mysql> exit;ubuntu
(password是剛纔設置的zabbix)vim
cd /usr/share/zabbix-server-mysql/
sudo gunzip *.gzapi
mysql -u zabbix -p zabbix < create.sql
sudo vi /etc/apache2/conf-enabled/zabbix.conf
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 max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai
(輸入系統密碼)
service zabbix-server start
sudo service apache2 restart
http://HOST_ip/zabbix/
(填寫mysql的密碼zabbix
填寫server_name爲zabbix server)
狂點下一步。
默認登陸帳號密碼 Admin/zabbix
sudo vi /usr/share/zabbix/include/locales.inc.php
第55行,'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true],
把display改成true,刷新頁面便可。
若是仍是不行,參考這裏
把zabbix-agent拷貝到home目錄
而後執行(因爲koala中缺乏一個庫,須要聯網安裝)
默認配置的服務器地址是192.168.1.200
#!/bin/bash
sudo
apt-get
install
libcurl3
sudo
dpkg -i ~
/zabbix-agent_3
.4.10-1+xenial_amd64.deb
sudo
sed
-i
'97s/127.0.0.1/192.168.1.200/g'
/etc/zabbix/zabbix_agentd
.conf
sudo
sed
-i
'138s/127.0.0.1/192.168.1.200/g'
/etc/zabbix/zabbix_agentd
.conf
sudo
sed
-i
'105s/# //g'
/etc/zabbix/zabbix_agentd
.conf
sudo
sed
-n
'/^Server=/p'
/etc/zabbix/zabbix_agentd
.conf
sudo
sed
-n
'/^ServerActive=/p'
/etc/zabbix/zabbix_agentd
.conf
sudo
sed
-n
'/^ListenPort=/p'
/etc/zabbix/zabbix_agentd
.conf
sudo
/etc/init
.d
/zabbix-agent
start