{"id":2458,"date":"2022-06-19T19:53:28","date_gmt":"2022-06-19T11:53:28","guid":{"rendered":"https:\/\/dasmz.com\/?p=2458"},"modified":"2022-06-19T21:34:06","modified_gmt":"2022-06-19T13:34:06","slug":"debian-11-%e7%8e%af%e5%a2%83%e4%b8%8b%ef%bc%8czabbix-proxy-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e5%90%91%e5%af%bc-2022-6-19","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=2458","title":{"rendered":"Debian 11 \u73af\u5883\u4e0b\uff0cZabbix-Proxy \u5b89\u88c5\u914d\u7f6e\u5411\u5bfc 2022-6-19"},"content":{"rendered":"\n<p><strong>\u6bb5\u843d1\u3001\u9700\u6c42<\/strong><\/p>\n\n\n\n<p>\u5c06\u5185\u7f51\u7684\u865a\u673a\u7edf\u4e00\u7528\u4e00\u53f0zabbix-proxy\u63a5\u5165\u7ba1\u7406<\/p>\n\n\n\n<p><strong>\u6bb5\u843d2\u3001\u73af\u5883<\/strong><\/p>\n\n\n\n<p>\u5b89\u88c5zabbix-proxy\u7684\u73af\u5883\u662f Debian 11 <\/p>\n\n\n\n<p>\u5b89\u88c5\u7684\u6570\u636e\u5e93\u662f MariaDB<\/p>\n\n\n\n<p><strong>\u6bb5\u843d3\u3001\u5b89\u88c5 MariaDB \u6570\u636e\u5e93<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u9996\u5148\u9700\u8981\u5b89\u88c5\u7684\u662f MariaDB\u6570\u636e\u5e93\uff0c\u7528\u6765\u4e34\u65f6\u5b58\u653e\u670d\u52a1\u5668\u68c0\u6d4b\u7684\u6570\u636e\u3002\u5b89\u88c5\u65b9\u5f0f\uff0c\u5176\u5b9e\u6bd4\u8f83\u7b80\u5355\uff0c\u4e0d\u9700\u8981\u6700\u65b0\u7248\u672c\u7684MariaDB\uff0c\u53ea\u9700\u8981\u5b89\u88c5apt\u91cc\u9762\u7684\u7248\u672c\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# apt update\nroot@ZabbixProxy:~# apt install wget\nroot@ZabbixProxy:~# apt install mariadb-server mariadb-client\nroot@ZabbixProxy:~# systemctl status mariadb\nroot@ZabbixProxy:~# mysql_secure_installation  #\u5b89\u5168\u52a0\u56fa\n\nSwitch to unix_socket authentication [Y\/n] n\nChange the root password? [Y\/n] Y\nRemove anonymous users? [Y\/n] Y\nDisallow root login remotely? [Y\/n] Y\nRemove test database and access to it? [Y\/n] Y\nReload privilege tables now? [Y\/n] Y\n\nroot@ZabbixProxy:~# systemctl enable mariadb<\/pre>\n\n\n\n<p>\u7279\u522b\u6ce8\u610f\uff0c\u4f60\u81ea\u5df1\u8bbe\u7f6e\u7684\u6570\u636e\u5e93root\u7684\u5bc6\u7801\uff0c\u4e0d\u8981\u8f6c\u5934\u5c31\u5fd8\u8bb0\u4e86\uff0c\u52a1\u5fc5\u8bb0\u4e0b\u6765<\/p>\n\n\n\n<p><strong>\u6bb5\u843d4\u3001\u521b\u5efa\u4e00\u4e2azabbix-proxy\u7528\u7684\u6570\u636e\u5e93\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n<p>\u6570\u636e\u5e93\u5b9e\u4f8b\u7684\u540d\u79f0\uff0c\u6211\u8fd9\u91cc\u5c31\u7528zabbix\uff0c\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u666e\u901a\u7528\u6237\u4e5f\u53eb\u505azabbix\uff0c\u6570\u636e\u5e93\u666e\u901a\u7528\u6237zabbix\u7684\u5bc6\u7801\u6700\u597d\u8ddf\u6570\u636e\u5e93root\u5bc6\u7801\u4e0d\u8981\u5199\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# mysql -uroot -p\n\u8fd9\u91cc\u8f93\u5165\u662f\u6570\u636e\u5e93root\u7528\u6237\u7684\u5bc6\u7801\nMariaDB> create database zabbix character set utf8 collate utf8_bin;\nMariaDB> create user zabbix@localhost identified by '\u8fd9\u91cc\u662fzabbix\u7528\u6237\u7684\u5bc6\u7801';\nMariaDB> grant all privileges on zabbix.* to zabbix@localhost;\nMariaDB> flush privileges;\nMariaDB> quit;<\/pre>\n\n\n\n<p><strong>\u6bb5\u843d5\u3001\u5b89\u88c5zabbix-proxy<\/strong><\/p>\n\n\n\n<p>zabbix-proxy\u67b6\u6784\u793a\u610f\uff0c\u5b83\u6709\u70b9\u50cf\u4e00\u4e2a\u63a5\u5165\u7f51\u5173\u7684\u4f5c\u7528<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"821\" height=\"421\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/example_of_zabbix_proxy_architecture.png\" alt=\"\" class=\"wp-image-2463\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/example_of_zabbix_proxy_architecture.png 821w, https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/example_of_zabbix_proxy_architecture-768x394.png 768w, https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/example_of_zabbix_proxy_architecture-624x320.png 624w\" sizes=\"(max-width: 821px) 100vw, 821px\" \/><\/figure>\n\n\n\n<p>\u5b89\u88c5\u7684zabbix-proxy\u7248\u672c\uff0c\u5fc5\u987b\u8ddfzabbix-server\u7248\u672c\u4e00\u81f4\u3002<\/p>\n\n\n\n<p>\u68c0\u67e5zabbix-server\u7684\u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixServer:~# zabbix_server -V<\/pre>\n\n\n\n<p>\u786e\u8ba4\u597d\u7248\u672c\u662f 4.0 LTS\/5.0 LTS\/ 6.0 LTS\uff0c\u5230\u5e95\u662f\u54ea\u4e2a\u4e4b\u540e\uff0c\u53bbzabbix\u5b98\u7f51\uff0c\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u53caOS\u7cfb\u7edf\u7684Zabbix repository\u7684deb\u6587\u4ef6<\/p>\n\n\n\n<p>\u6211\u8fd9\u91cc\u751f\u4ea7\u73af\u5883\u662f4.0 LTS\u7684\uff0c\u8fd9\u4e2a\u751f\u4ea7\u73af\u5883\u5efa\u8bbe\u7684\u65e9\uff0c\u6240\u4ee5\u7248\u672c\u65e7\uff0c\u4f60\u4eec\u6839\u636e\u4f60\u4eeczabbix-server\u7684\u5b9e\u9645\u7248\u672c\uff0c\u8fdb\u884c\u4e0b\u8f7d<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# wget https:\/\/repo.zabbix.com\/zabbix\/4.0\/debian\/pool\/main\/z\/zabbix-release\/zabbix-release_4.0-4+debian11_all.deb\nroot@ZabbixProxy:~# dpkg -i zabbix-release_4.0-4+debian11_all.deb\nroot@ZabbixProxy:~# apt update\nroot@ZabbixProxy:~# apt-get install zabbix-proxy-mysql\nroot@ZabbixProxy:~# zcat \/usr\/share\/doc\/zabbix-proxy-mysql\/schema.sql.gz | mysql -uzabbix -p zabbix   # \u5bfc\u5165\u76f8\u5173\u6570\u636e\u8868\u7ed3\u6784\n\/\/ \u8fd9\u91cc\u8f93\u5165\u7684\u662f\uff0c\u521a\u521a\u7684\uff0c\u6570\u636e\u5e93 \u7528\u6237zabbix\u7684\u5bc6\u7801<\/pre>\n\n\n\n<p>\u5bfc\u5165\u8868\u7ed3\u6784\u7684\u65f6\u5019\uff0c\u6709\u4e00\u4e2a\u5c0f\u62a5\u9519\uff0c\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ERROR 1118 (42000) at line 1278: Row size too large (> 8126). \nChanging some columns to TEXT or BLOB may help. \nIn current row format, BLOB prefix of 0 bytes is stored inline.<\/pre>\n\n\n\n<p>\u4e3b\u8981\u6765\u81ea innodb_strict_mode \u53c2\u6570\u7684\u5f71\u54cd\uff0c\u8fd9\u91cc\u91cd\u65b0\u767b\u5f55\u6570\u636e\u5e93\uff0c\u5220\u9664zabbix\u6570\u636e\u5e93\uff0c\u4fee\u6539\u5bf9\u5e94\u7684SQL\u6587\u4ef6\uff0c\u91cd\u65b0\u5bfc\u5165\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# mysql -uroot -p\n\u8fd9\u91cc\u8f93\u5165\u662f\u6570\u636e\u5e93root\u7528\u6237\u7684\u5bc6\u7801\nMariaDB> drop database zabbix;\nMariaDB> create database zabbix character set utf8 collate utf8_bin;\nMariaDB> grant all privileges on zabbix.* to zabbix@localhost;\nMariaDB> flush privileges;\nMariaDB> quit;<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"716\" height=\"245\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-20-54-51.png\" alt=\"\" class=\"wp-image-2489\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-20-54-51.png 716w, https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-20-54-51-624x214.png 624w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><\/figure>\n\n\n\n<p>\u4fee\u6539\u6570\u636e\u5e93\u7684SQL\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# cd \/usr\/share\/doc\/zabbix-proxy-mysql\nroot@ZabbixProxy:~# gzip -d schema.sql.gz\nroot@ZabbixProxy:~# vi schema.sql\n\u65b0\u589e\u4e00\u884c\u5230\u6587\u4ef6\u5f00\u5934 SET SESSION innodb_strict_mode=OFF;<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"766\" height=\"484\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-20-59-01.png\" alt=\"\" class=\"wp-image-2490\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-20-59-01.png 766w, https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-20-59-01-624x394.png 624w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# cat schema.sql | mysql -uzabbix -p zabbix\n\/\/ \u8fd9\u91cc\u8f93\u5165\u7684\u662f\uff0c\u6570\u636e\u5e93\u7528\u6237zabbix\u7684\u5bc6\u7801<\/pre>\n\n\n\n<p>\u5b8c\u7f8e\u7684\u6210\u529f\u5bfc\u5165\u5168\u90e8\u8868\u7ed3\u6784\uff0c\u65e0\u62a5\u9519\u3002\u53ef\u4ee5\u767b\u5f55\u8fdbzabbix\u5e93\uff0c\u67e5\u770b\u4e00\u4e0b\u5bfc\u5165\u7684\u8868\u3002<\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"390\" height=\"728\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-21-01-40.png\" alt=\"\" class=\"wp-image-2495\"\/><\/figure><\/div>\n\n\n<p><strong>\u6bb5\u843d6\u3001\u4fee\u6539\u4e00\u4e0bzabbix-proxy\u7684\u914d\u7f6e\u6587\u4ef6\u53c2\u6570<\/strong><\/p>\n\n\n\n<p>\u914d\u7f6e\u6587\u4ef6\u7684\u8def\u5f84 \/etc\/zabbix\/zabbix_proxy.conf<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Server=127.0.0.1  --> \u9700\u8981\u4fee\u6539\u5230\u4f60\u7684Zabbix-Server\u5730\u5740\nHostname=Zabbix proxy  --> \u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u540d\u79f0zabbixproxy\nLogFile=\/var\/log\/zabbix\/zabbix_proxy.log\nLogFileSize=0\nPidFile=\/var\/run\/zabbix\/zabbix_proxy.pid\nSocketDir=\/var\/run\/zabbix\nDBName=zabbix       --> \u9700\u8981\u6307\u5b9a\u4f60\u521a\u521a\u914d\u7f6e\u7684\u6570\u636e\u5e93\u5b9e\u4f8b\u540d\u79f0\uff0c\u6211\u8fd9\u91cc\u662fzabbix\nDBUser=zabbix       --> \u9700\u8981\u6307\u5b9a\u4f60\u521a\u521a\u914d\u7f6e\u7684\u6570\u636e\u5e93\u666e\u901a\u7528\u6237\u540d\uff0c\u6211\u8fd9\u91cc\u662fzabbix\nDBPassword=passforuserzabbix --> \u9700\u8981\u6307\u5b9a\u4f60\u521a\u521a\u914d\u7f6e\u7684\u6570\u636e\u5e93\u666e\u901a\u7528\u6237\u5bf9\u5e94\u7684\u5bc6\u7801\nConfigFrequency=300     --> \u9700\u8981\u6307\u5b9a\u65f6\u95f4\u95f4\u9694-\u83b7\u53d6\u914d\u7f6e-\u79d2\nDataSenderFrequency=30  --> \u9700\u8981\u6307\u5b9a\u65f6\u95f4\u95f4\u9694-\u4e0a\u4f20\u6570\u636e-\u79d2\nSNMPTrapperFile=\/var\/log\/snmptrap\/snmptrap.log\nTimeout=4\nExternalScripts=\/usr\/lib\/zabbix\/externalscripts\nFpingLocation=\/usr\/bin\/fping\nFping6Location=\/usr\/bin\/fping6\nLogSlowQueries=3000<\/pre>\n\n\n\n<p>\u4fee\u6539\u5b8c\u6210\u914d\u7f6e\u6587\u4ef6\uff0c\u91cd\u542f\u4e00\u4e0bzabbix-proxy<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@ZabbixProxy:~# systemctl restart zabbix-proxy\nroot@ZabbixProxy:~# systemctl enable zabbix-proxy<\/pre>\n\n\n\n<p><strong>\u6bb5\u843d7\u3001\u767b\u5f55zabbix-server\u7684WEB\u9875\u9762\uff0c\u6ce8\u518c\u521a\u521a\u914d\u7f6e\u7684zabbix-proxy<\/strong><\/p>\n\n\n\n<p>\u5728\u7ba1\u7406\u9875\u9762\uff0c\u70b9\u51fb\u521b\u5efa\u4ee3\u7406<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"1482\" height=\"287\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-21-19-35.png\" alt=\"\" class=\"wp-image-2502\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-21-19-35.png 1482w, https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-21-19-35-768x149.png 768w, https:\/\/dasmz.com\/wp-content\/uploads\/2022\/06\/Screenshot-from-2022-06-19-21-19-35-624x121.png 624w\" sizes=\"(max-width: 1482px) 100vw, 1482px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6bb5\u843d1\u3001\u9700\u6c42 \u5c06\u5185\u7f51\u7684\u865a\u673a\u7edf\u4e00\u7528\u4e00\u53f0zabbix-proxy\u63a5\u5165\u7ba1\u7406 \u6bb5\u843d2\u3001\u73af\u5883 \u5b89\u88c5zabbix-prox [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/2458"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2458"}],"version-history":[{"count":29,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/2458\/revisions"}],"predecessor-version":[{"id":2505,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/2458\/revisions\/2505"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}