{"id":1257,"date":"2024-11-04T14:27:19","date_gmt":"2024-11-04T06:27:19","guid":{"rendered":"https:\/\/www.jchj.top\/?p=1257"},"modified":"2025-11-03T10:06:55","modified_gmt":"2025-11-03T02:06:55","slug":"zabbix%e7%9b%91%e6%8e%a7%e8%bf%81%e7%a7%bb%e8%87%b3docker%e5%ae%b9%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.jchj.top\/?p=1257","title":{"rendered":"Zabbix\u76d1\u63a7\u8fc1\u79fb\u81f3docker\u5bb9\u5668"},"content":{"rendered":"\n<p><strong>1:\u5b89\u88c5docker<\/strong><\/p>\n\n\n\n<p>        \u9009\u62e9docker\u955c\u50cf\u5b89\u88c5\u3001\u542f\u52a8\u3001\u5f00\u673a\u81ea\u542f\u52a8\u3001\u72b6\u6001 (\u5982\u4f55\u5b89\u88c5docker\u53ef\u53c2\u8003\u672c\u7f51\u7ad9\u6559\u7a0b\uff09<\/p>\n\n\n\n<p>[root@localhost ~]# systemctl start docker<\/p>\n\n\n\n<p>[root@localhost ~]# systemctl enable docker<\/p>\n\n\n\n<p>[root@localhost ~]# systemctl status docker<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"107\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2024\/11\/image.png\" alt=\"\" class=\"wp-image-1258\" style=\"width:844px;height:auto\"\/><\/figure>\n\n\n\n<p><strong>2:Zabbix\u7684\u67b6\u6784\u4fe1\u606f\uff1a<\/strong><\/p>\n\n\n\n<p>zabbix-server<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zabbix \u7684server \u7aef\uff0c\u8d1f\u8d23\u63a5\u6536agent\u53d1\u9001\u8fc7\u6765\u7684\u76d1\u63a7\u6570\u636e\uff0c\u5e76\u4e14\u63d0\u4f9bzabbix\u7684\u6240\u6709\u6838\u5fc3\u529f\u80fd\u3002<\/p>\n\n\n\n<p>database<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u7528\u4e8e\u5b58\u50a8\u76d1\u63a7\u6570\u636e\u548c\u914d\u7f6e\u4fe1\u606f\u7684\u6570\u636e\u5e93\uff0c\u76ee\u524d\u5e38\u7528\u7684\u6709mysql\u548cpostgresql\u4e24\u79cd\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<p>zabbix-web<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zabbix\u7684UI\u7aef\uff0c\u63d0\u4f9b\u64cd\u4f5c\u63a7\u5236\u53f0\u548c\u76d1\u63a7\u5c55\u793a\u7b49\u529f\u80fd\u3002<\/p>\n\n\n\n<p>zabbix-java-gateway<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u7528\u4e8e\u76d1\u63a7Java\u7a0b\u5e8f\u7684JVM\u72b6\u6001\uff0czabbix\u672c\u8eab\u65e0\u6cd5\u76f4\u63a5\u4ecejvm\u83b7\u53d6\u76d1\u63a7\u6307\u6807\uff0c\u9700\u4f7f\u7528\u8be5\u7f51\u5173\u6765\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p>zabbbix-agent<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zabbix\u7684\u4ee3\u7406\u7aef\uff0c\u90e8\u7f72\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\uff0c\u7528\u4e8e\u6536\u96c6\u4e3b\u673a\u7684\u76d1\u63a7\u6570\u636e\uff0c\u5e76\u63d0\u4f9b\u7ed9\u5230zabbix server\u3002<\/p>\n\n\n\n<p><strong>3:\u90e8\u7f72Zabbix\u7ec4\u4ef6\uff1a<\/strong><\/p>\n\n\n\n<p>\u8fd0\u884cmysql8.0\u955c\u50cf\u5bb9\u5668\uff1a(\u8bf4\u660e\uff1azabbix6.x\u7248\u672c\u8981\u6c42\u4f7f\u7528mysql8.0\u3002)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;\u521b\u5efa\u5b58\u50a8\u5377\uff0c\u7528\u4e8e\u6301\u4e45\u5316mysql\u6570\u636e\uff1a<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">docker volume create -d local mysql_data # \u5b58\u653emysql\u7684\u6570\u636e<br>docker volume create -d local mysql_logs # \u5b58\u653emysql\u7684\u65e5\u5fd7<br>docker volume create -d local mysql_conf # \u5b58\u653emysql\u7684\u914d\u7f6e\u6587\u4ef6<\/mark><\/p>\n\n\n\n<p>\u8fd0\u884c\u5bb9\u5668mysql8\uff1a<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u8fd9\u91ccdocker run\u7684\u65f6\u5019\u5982\u679c\u672c\u5730\u6ca1\u6709\u955c\u50cf\u6216\u76f4\u63a5\u5728dockerHUB\u4e0a\u62c9\u53d6mysql-server\u955c\u50cf,\u6307\u5b9amysql\u6570\u636e\u5e93\u7684\u914d\u7f6e\u6587\u4ef6\u3001\u6570\u636e\u6587\u4ef6\u3001\u65e5\u5fd7\u7684\u5b58\u50a8\u5377\u3001\u521b\u5efa\u6570\u636e\u5e93\u4ee5\u53ca\u7528\u6237\u540d\u5bc6\u7801\u3001\u6ce8\u5b9a\u6570\u636e\u5e93\u7684\u7248\u672c\u7b49\u914d\u7f6e\u4fe1\u606f<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">docker run &#8211;name mysql-server -t \\<br>-v mysql_data:\/var\/lib\/mysql \\<br>-v mysql_logs:\/var\/log\/mysql \\<br>-v mysql_conf:\/etc\/mysql \\<br>-e MYSQL_DATABASE=&#8221;zabbix&#8221; \\<br>-e TZ=\u201cAsia\/Shanghai\u201d \\<br>-e MYSQL_USER=&#8221;zbxuser&#8221; \\<br>-e MYSQL_PASSWORD=&#8221;123456&#8243; \\<br>-e MYSQL_ROOT_PASSWORD=&#8221;123456&#8243; \\<br>&#8211;restart=unless-stopped \\<br>-p 3306:3306 \\<br>-d mysql:8.0 \\<br>&#8211;character-set-server=utf8 &#8211;collation-server=utf8_bin \\<br>&#8211;default-authentication-plugin=mysql_native_password<\/mark><\/p>\n\n\n\n<p>TZ=\u201cAsia\/Shanghai\u201d \u4e3a\u8bbe\u7f6e\u5bb9\u5668\u7684\u65f6\u533a\uff0c\u5426\u5219\u544a\u8b66\u65f6\u95f4\u4f1a\u6709\u95ee\u9898\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"318\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2024\/11\/image-1.png\" alt=\"\" class=\"wp-image-1259\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<p>\u5b89\u88c5zabbix-java-gateway\uff1a<br>Zabbix\u672c\u8eab\u4e0d\u652f\u6301\u76f4\u63a5\u76d1\u63a7Java\uff0c\u800c\u662f\u4f7f\u7528zabbix-java-gateway\u76d1\u63a7jvm\/tomcat\u6027\u80fd\u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528latest\u7248\u672c\uff0c\u5728linux\u7ec8\u7aef\u4f7f\u7528\u3002<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">docker run &#8211;name zabbix-java-gateway -t \\<br>&#8211;restart=unless-stopped \\<br>-d zabbix\/zabbix-java-gateway:latest<\/mark><\/p>\n\n\n\n<p>\u6ce8\u610f\uff1a\u5982\u679c\u6709\u4e9b\u955c\u50cf\u4e0b\u8f7d\u6162\u6216\u65e0\u6cd5\u4e0b\u8f7d\u5c31\u9700\u8981\u66f4\u6539\u4e3a\u56fd\u5185\u6e90\u6587<br>[root@localhost ~]# vim \/etc\/docker\/daemon.json<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"102\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2024\/11\/image-2.png\" alt=\"\" class=\"wp-image-1260\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<p>\u5b89\u88c5zabbix-server:<br>\u521b\u5efa\u5b58\u50a8\u5377\uff0c\u7528\u4e8e\u5b58\u50a8zabbix\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"140\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2024\/11\/image-3.png\" alt=\"\" class=\"wp-image-1261\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<p>   \u8fd0\u884czabbix-server\u5bb9\u5668\uff0c\u5f00\u653e10051\/TCP\u7aef\u53e3\uff0c\u7528\u4e8e\u63a5\u6536\u76d1\u63a7\u6570\u636e\u3002\u6dfb\u52a0&#8211;link\u53c2\u6570\uff0c\u5b9e\u73b0mysql\u548cjava-gateway\u5bb9\u5668\u95f4\u7684\u4e92\u76f8\u901a\u4fe1\u3002<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">docker run &#8211;name zabbix-server-mysql -t \\<br>-v zabbix_server:\/etc\/zabbix \\<br>-e DB_SERVER_HOST=&#8221;mysql-server&#8221; \\<br>-e MYSQL_DATABASE=&#8221;zabbix&#8221; \\<br>-e MYSQL_USER=&#8221;zbxuser&#8221; \\<br>-e MYSQL_PASSWORD=&#8221;123456&#8243; \\<br>-e MYSQL_ROOT_PASSWORD=&#8221;123456&#8243; \\<br>-e ZBX_JAVAGATEWAY=&#8221;zabbix-java-gateway&#8221; \\<br>&#8211;link mysql-server:mysql \\<br>&#8211;link zabbix-java-gateway:zabbix-java-gateway \\<br>&#8211;restart=unless-stopped \\<br>-p 10051:10051 \\<br>-d zabbix\/zabbix-server-mysql:6.2.5-alpine<\/mark><\/p>\n\n\n\n<p>\u6ce8\u91ca\uff1a\u6b64\u65b9\u5f0f\u9002\u5408\u6240\u6709\u5bb9\u5668\u90e8\u7f72\u5728\u540c\u4e00\u53f0\u4e3b\u673a\u4e0a\uff0c\u5982\u679c\u662f\u5206\u5f00\u90e8\u7f72\uff0c\u5219\u5728\u524d\u9762\u7684\u6b65\u9aa4\u9700\u8981\u5f00\u653e\u76f8\u5173\u7aef\u53e3\uff0c\u5e76\u901a\u8fc7\u5c40\u57df\u7f51\u8fdb\u884c\u8fde\u63a5\u3002<\/p>\n\n\n\n<p><strong>\u5b89\u88c5Zabbix web\u9875\u9762\uff1a<\/strong><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;\u8fd0\u884czabbix-web\u5bb9\u5668\uff1a<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">docker run &#8211;name zabbix-web-nginx-mysql -t \\<br>-e PHP_TZ=&#8221;Asia\/Shanghai&#8221; \\<br>-e ZBX_SERVER_HOST=&#8221;zabbix-server-mysql&#8221; \\<br>-e DB_SERVER_HOST=&#8221;mysql-server&#8221; \\<br>-e MYSQL_DATABASE=&#8221;zabbix&#8221; \\<br>-e MYSQL_USER=&#8221;zbxuser&#8221; \\<br>-e MYSQL_PASSWORD=&#8221;123456&#8243; \\<br>-e MYSQL_ROOT_PASSWORD=&#8221;123456&#8243; \\<br>&#8211;link mysql-server:mysql \\<br>&#8211;link zabbix-server-mysql:zabbix-server \\<br>-p 80:8080 \\<br>&#8211;restart unless-stopped \\<br>-d zabbix\/zabbix-web-nginx-mysql:alpine-6.2-latest<\/mark><\/p>\n\n\n\n<p>\u5f53\u76d1\u63a7\u4e3b\u673a\u8fc7\u591a\u7684\u65f6\u5019zabb\u8fdb\u7a0b\u5bb9\u6613\u6302\u6b7b\uff0c\u9700\u8981\u5728\u542f\u52a8\u5bb9\u5668\u7684\u65f6\u5019\u8bbe\u7f6e\u73af\u5883\u53d8\u91cfZBX_CACHESIZE=\u201c1024M\u201d \uff0c\u9ed8\u8ba4\u53c2\u6570\u4e3a8M\u3002<br>-e ZBX_VMWAREFREQUENCY=&#8221;10&#8243; \\<br>-e ZBX_VMWAREPERFFREQUENCY=&#8221;60&#8243; \\<br>-e ZBX_VMWARECACHESIZE=&#8221;1024M&#8221; \\<br>-e ZBX_VMWARETIMEOUT=&#8221;30&#8243; \\<\/p>\n\n\n\n<p>\u6d4f\u89c8\u5668\u8bbf\u95ee\uff1a<br>http:\/\/IP\u5730\u5740<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"3164\" height=\"1799\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2024\/11\/\u56fe\u72471.png\" alt=\"\" class=\"wp-image-1262\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>1:\u5b89\u88c5docker \u9009\u62e9docker\u955c\u50cf\u5b89\u88c5\u3001\u542f&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,21,1],"tags":[],"class_list":["post-1257","post","type-post","status-publish","format-standard","hentry","category-k8s-docker","category-linux","category-1"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/1257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1257"}],"version-history":[{"count":1,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/1257\/revisions"}],"predecessor-version":[{"id":1263,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/1257\/revisions\/1263"}],"wp:attachment":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}