docker for zabbix

docker run -d -v /home/zabbix/mysql --name zabbix-db-storage busybox:latest


docker run -d --name zabbix-db -v /home/zabbix/backups:/backups     -v /etc/localtime:/etc/localtime:ro --volumes-from zabbix-db-storage     --env="MARIADB_USER=zabbix" --env="MARIADB_PASS=my_password" monitoringartist/zabbix-db-mariadb


docker run -d --name zabbix -p 80:80 -p 10051:10051 -v /etc/localtime:/etc/localtime:ro --link zabbix-db:zabbix.db --env="ZS_DBHost=zabbix.db" --env="ZS_DBUser=zabbix" --env="ZS_DBPassword=my_password" --env="PHP_memory_limit=512M" monitoringartist/zabbix-xxl:latest

 

往容器内拷贝字体
docker cp simkai.ttf zabbix:/usr/local/src/zabbix/frontends/php/fonts/
字体路径
/usr/local/src/zabbix/frontends/php/fonts/simkai.ttf
进入docker
docker exec -it zabbix /bin/bash
php配置文件路径,修改字体文件
vi /usr/local/src/zabbix/frontends/php/include/defines.inc.php

define('ZBX_GRAPH_FONT_NAME', 'simkai');
define('ZBX_FONT_NAME', 'simkai');

zabbix-server配置文件
vi /usr/local/etc/zabbix_server.conf
zabbix-server报警文件
cd /usr/local/share/zabbix/alertscripts/

scp 172.18.1.20:/remote/scripts/sendmail.sh ./

docker exec -it zabbix /bin/bash
yum install -y mailx
yum install -y dos2unix
## 确保sendmail.sh能够执行成功

vi /etc/mail.rc
##插入以下内容
set from=message@le-yao.com
set smtp=smtp.exmail.qq.com
set smtp-auth-user=message@le-yao.com
set smtp-auth-password=Leyao@2016
set smtp-auth=login

重启docker
docker restart zabbix

 

迁移

docker exec -it zabbix-db /bin/bash

mysql -uzabbix -pmy_password

use zabbix;
source /backups/zabbix2.sql;
SET collation_server = utf8_general_ci;
SET collation_database = utf8_general_ci;
SET collation_connection = utf8_general_ci;

 

posted on 2019-03-13 10:51  Karlkiller  阅读(150)  评论(0编辑  收藏  举报

导航