{"id":647,"date":"2020-03-16T17:11:17","date_gmt":"2020-03-16T09:11:17","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=647"},"modified":"2020-03-16T17:27:37","modified_gmt":"2020-03-16T09:27:37","slug":"647","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2020\/03\/647\/","title":{"rendered":"Docker \u90e8\u7f72Zabbix \u76d1\u63a7"},"content":{"rendered":"\n
\u53c2\u8003\u535a\u5ba2\uff1ahttps:\/\/www.cnblogs.com\/root0\/p\/9812789.html<\/a> <\/p>\u5728\u5b9e\u9645\u90e8\u7f72\u4e2d\u7a0d\u505a\u6539\u52a8\uff0c\u505a\u8bb0\u5f55<\/cite><\/blockquote>\n\n\n\n
1 \u5b98\u65b9\u5730\u5740<\/h2>\n\n\n\n
\u5b98\u65b9\u5199\u7684\u5f88\u8be6\u7ec6\u5e76\u4e14\u662f\u4e2d\u6587\u7684,\u4e00\u6b65\u6b65\u6309\u7167\u64cd\u4f5c\u5c31\u53ef\u4ee5<\/p>\n\n\n\n
https:\/\/www.zabbix.com\/documentation\/3.4\/zh\/manual\/installation\/containers<\/code><\/pre>\n\n\n\n
2 \u542f\u52a8\u4e00\u4e2a\u7a7a\u7684Mysql\u670d\u52a1\u5668\u5b9e\u4f8b<\/h2>\n\n\n\n
docker run --name mysql-server -t \\\n -e MYSQL_DATABASE=\"zabbix\" \\\n -e MYSQL_USER=\"zabbix\" \\\n -e MYSQL_PASSWORD=\"zabbix_111\" \\\n -e MYSQL_ROOT_PASSWORD=\"root_111\" \\\n -v \/data\/mysql:\/var\/lib\/mysql \\\n -p 3306:3306 \\\n -d mysql<\/pre>\n\n\n\n3 \u542f\u52a8Zabbix server\u5b9e\u4f8b\uff0c\u5e76\u5173\u8054\u8fd9\u4e2a\u5b9e\u4f8b\u5230\u5df2\u521b\u5efa\u7684MySQL\u670d\u52a1\u5668\u5b9e\u4f8b<\/h2>\n\n\n\n
docker run --name zabbix-server-mysql -t \\\n -e DB_SERVER_HOST=\"192.168.0.30\" \\\n -e MYSQL_DATABASE=\"zabbix\" \\\n -e MYSQL_USER=\"zabbix\" \\\n -e MYSQL_PASSWORD=\"zabbix_111\" \\\n -e MYSQL_ROOT_PASSWORD=\"root_111\" \\\n --link mysql-server:mysql \\\n -p 10051:10051 \\\n -d zabbix\/zabbix-server-mysql:latest <\/pre>\n\n\n\n4 \u542f\u52a8Zabbix web \u63a5\u53e3\uff0c\u5e76\u5c06\u5b83\u4e0eMySQL\u670d\u52a1\u5668\u5b9e\u4f8b\u548cZabbix server\u5b9e\u4f8b\u5173\u8054<\/h2>\n\n\n\n
\u52a0\u4e86\u4e00\u4e2a\u914d\u7f6e\u6587\u6863\u7684\u6302\u8f7d\uff0c -v \/etc\/php\/99-zabbix.ini:\/etc\/php7\/conf.d\/99-zabbix.ini \u7528\u6765\u4fee\u6539\u65f6\u533a\u8bbe\u7f6e\uff0c<\/p><\/blockquote>\n\n\n\n
vim \/etc\/php\/99-zabbix.ini\n max_execution_time=600\n memory_limit=128M\n post_max_size=16M\n upload_max_filesize=2M\n max_input_time=300\n ; always_populate_raw_post_data=-1\n max_input_vars=10000\n ; date.timezone=Europe\/Riga\n date.timezone=Asia\/Shanghai<\/strong>\n ; session.save_path=\/var\/lib\/php7<\/pre>\n\n\n\ndocker run --name zabbix-nginx -t \\\n -e DB_SERVER_HOST=\"192.168.0.30\" \\\n -e MYSQL_DATABASE=\"zabbix\" \\\n -e MYSQL_USER=\"zabbix\" \\\n -e MYSQL_PASSWORD=\"zabbix_111\" \\\n -e MYSQL_ROOT_PASSWORD=\"root_111\" \\\n --link mysql-server:mysql \\\n --link zabbix-server-mysql:zabbix-server \\\n -v \/etc\/php\/99-zabbix.ini:\/etc\/php7\/conf.d\/99-zabbix.ini \\\n -p 80:80 \\\n -d zabbix\/zabbix-web-nginx-mysql:latest<\/pre>\n\n\n\n5 \u67e5\u770b\u5bb9\u5668\u542f\u52a8\u60c5\u51b5 <\/h2>\n\n\n\n
[root@zabbix_server ~]# docker ps\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n98cbe8d8a6bd zabbix\/zabbix-web-nginx-mysql:latest \"docker-entrypoint.sh\" 6 seconds ago Up 5 seconds 443\/tcp, 0.0.0.0:8080->80\/tcp zabbix-web-nginx-mysql\nde040d43d60f zabbix\/zabbix-server-mysql:latest \"docker-entrypoint.sh\" 59 seconds ago Up 59 seconds 0.0.0.0:10051->10051\/tcp zabbix-server-mysql\n3276f18def8d mysql:5.7 \"docker-entrypoint.s\u2026\" About a minute ago Up About a minute 3306\/tcp mysql-server<\/pre>\n\n\n\n[root@zabbix_server ~]# docker images\nREPOSITORY TAG IMAGE ID CREATED SIZE\nzabbix\/zabbix-web-nginx-mysql latest 4db891b4393a 10 hours ago 177MB\nzabbix\/zabbix-server-mysql latest f5e58dafe9ac 10 hours ago 62.2MB\nmysql 5.7 f0f3956a9dd8 7 days ago 409MB<\/pre>\n\n\n\n6 \u4fee\u6539\u9632\u706b\u5899<\/h2>\n\n\n\n
iptables -P FORWARD ACCEPT<\/p>\n\n\n\n
7 \u8bbf\u95eeweb\u754c\u9762<\/h2>\n\n\n\n
http:\/192.168.0.30:80<\/a><\/p>\n\n\n\n
\u5e10\u53f7\u5bc6\u7801:
Admin
zabbix<\/p>\n\n\n\n