os: ubuntu 16.04
zabbix: 3.4
ip 规划
192.168.56.101 node1 pgsql 9.6 master
192.168.56.102 node2 pgsql 9.6 slave
192.168.56.103 node3 zabbix proxy
192.168.56.104 node4 zabbix server
本篇blog介绍在 node4 节点上安装 zabbix server 的具体过程。
基本参照 zabbix 的官网,因为官网的介绍真的很清晰。
选定
zabbix version:3.4
os distribution:ubuntu
os version:16.04(Xenial)
database:mysql
https://www.zabbix.com/download?zabbix=3.4&os_distribution=ubuntu&os_version=xenial&db=MySQL
Install and configure Zabbix server
Install Repository with MySQL database
# wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
# dpkg -i zabbix-release_3.4-1+xenial_all.deb
# apt update
Install Zabbix server, frontend, agent
本次在zabbix server端没有安装 zabbix-agent
# apt install zabbix-server-mysql zabbix-frontend-php
# ls -l /etc/zabbix/
Create initial database
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> exit;
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
提示错误 ERROR 1071 (42000) at line 162: Specified key was too long; max key length is 767 bytes
这个是需要修改 my.cnf
# vi /etc/mysql/mariadb.conf.d/50-server.cnf
innodb_large_prefix = on
innodb_file_format=BARRACUDA
Configure the database for Zabbix server
# vi /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
CacheSize=256M
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
FpingLocation=/usr/bin/fping
Fping6Location=/usr/bin/fping6
LogSlowQueries=3000
Configure PHP for Zabbix frontend
# vi /etc/zabbix/apache.conf
php_value date.timezone Asia/Shanghai
Start Zabbix server and agent processes
# systemctl restart zabbix-server apache2
# systemctl enable zabbix-server apache2
或者使用
# update-rc.d zabbix-server apache2 defaults 90
查看 zabbix_server 监听端口
# netstat -antp|grep -i zabbix
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 19701/zabbix_server
tcp6 0 0 :::10051 :::* LISTEN 19701/zabbix_server
# netstat -lntp|grep -i zabbix
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 19701/zabbix_server
tcp6 0 0 :::10051 :::* LISTEN 19701/zabbix_server
Configure Zabbix frontend
Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix
Follow steps described in Zabbix documentation: Installing frontend https://www.zabbix.com/documentation/3.4/manual/installation/install#installing_frontend
Start using Zabbix
See Quickstart guide https://www.zabbix.com/documentation/3.4/manual/quickstart/login
用户名:Admin
密码:zabbix
Some Path
Configuration files are placed in /etc/zabbix.
Zabbix server, proxy and agent logfiles are placed in /var/log/zabbix.
Zabbix frontend is placed in /usr/share/zabbix.
Home directory for user zabbix is /var/lib/zabbix.
Frontend timezone is set to Europe/Riga (this can be modified in /etc/apache2/conf-available/zabbix.conf);
# ls -l /etc/apache2/conf-available
lrwxrwxrwx 1 root root 23 Jul 19 16:01 zabbix.conf -> /etc/zabbix/apache.conf
参考:
https://www.zabbix.com/download
https://www.zabbix.com/documentation/3.4/manual
https://www.zabbix.com/documentation/3.4/manual/installation/install_from_packages