一.Zabbix安装配置(ubuntu)
1、Zabbix服务端安装 基础情况
系统
Ubuntu 14.04.4 LTS
zabbix版本
zabbix 3.2
ip
192.168.1.**
1.1 Zabbix服务端安装
#设置zabbix源
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+trusty_all.deb
dpkg -i zabbix-release_3.2-1+trusty_all.deb
apt-get update
#安装
apt-get install zabbix-server-mysql zabbix-frontend-php
#mysql配置
shell> mysql -uroot -p<root_password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
#配置zabbix server
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#启动zabbix
service zabbix-server start
update-rc.d zabbix-server enable
#设置php
vim /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 always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai
#启动apache
#cp -r /usr/share/zabbix /var/www/html/zabbix
service apache2 restart
1.2、Zabbix服务端配置文件
grep -v '#' /etc/zabbix/zabbix_server.conf | grep -v '^$'
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Timeout=30 #设置获取数据超时时间
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
FpingLocation=/usr/bin/fping
Fping6Location=/usr/bin/fping6
LogSlowQueries=3000
2、Zabbix客户端安装配置
2.1 zabbix客户端安装 ubuntu 14.04
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+trusty_all.deb
dpkg -i zabbix-release_3.2-1+trusty_all.deb
apt-get update
apt-get install zabbix-agent
service zabbix-agent start
centos 7
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
yum install zabbix-agent
systemctl start zabbix-agent
centos 6
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
yum install zabbix-agent
service zabbix-agent start
2.2、zabbix客户端配置
grep -v '#' /etc/zabbix/zabbix_agentd.conf
Server=192.168.1.** #服务器端ip
ServerActive=192.168.1.**:10051 #上报数据 服务端ip+端口
LogFile=/var/log/zabbix/zabbix_agentd.log
PidFile=/var/run/zabbix/zabbix_agentd.pid
Hostname=192.168.1.** #客户端ip
UnsafeUserParameters=1
AllowRoot=1
RefreshActiveChecks=60
ListenIP=192.168.1.** #客户端ip
Include=/etc/zabbix/zabbix_agentd.d/
HostMetadata=Linux #用于自动发现
二.Zabbix安装配置(docker)
参考官网zabbix3.2
数据库:mysql
-
Start empty MySQL server instance
docker run --name mysql-server -t \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="zabbix_pwd" \ -e MYSQL_ROOT_PASSWORD="root_pwd" \ -d mysql:5.7
-
Start Zabbix Java gateway instance
docker run --name zabbix-java-gateway -t \ -d zabbix/zabbix-java-gateway:latest
-
Start Zabbix server instance and link the instance with created MySQL server instance
docker run --name zabbix-server-mysql -t \ -e DB_SERVER_HOST="mysql-server" \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="zabbix_pwd" \ -e MYSQL_ROOT_PASSWORD="root_pwd" \ -e ZBX_JAVAGATEWAY="zabbix-java-gateway" \ --link mysql-server:mysql \ --link zabbix-java-gateway:zabbix-java-gateway \ -p 10051:10051 \ -d zabbix/zabbix-server-mysql:latest
Zabbix server instance exposes 10051/TCP port (Zabbix trapper) to host machine.
-
Start Zabbix web interface and link the instance with created MySQL server and Zabbix server instances
docker run --name zabbix-web-nginx-mysql -t \ -e DB_SERVER_HOST="mysql-server" \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="zabbix_pwd" \ -e MYSQL_ROOT_PASSWORD="root_pwd" \ --link mysql-server:mysql \ --link zabbix-server-mysql:zabbix-server \ -p 80:80 \ -d zabbix/zabbix-web-nginx-mysql:latest
用户:Admin
初始密码:zabbix