{"id":288239,"date":"2018-08-20T11:45:08","date_gmt":"2018-08-20T07:45:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288239"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288239","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c GeoIP exporter \u0434\u043b\u044f Prometheus \u0441 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 Grafana \u0437\u0430 15 \u043c\u0438\u043d\u0443\u0442"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420633\/\" class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gq\/e3\/ss\/gqe3ssl-nxvojbk1gnvm794kihi.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c! <\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0442\u0435\u043c, \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u0434\u043b\u044f Prometheus \u043d\u0430 Golang \u0438 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0442\u0435\u043c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0442\u0435\u043a\u0443\u0449\u0438\u0435 TCP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"0-disclaimer\">0. Disclaimer<\/h1>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0447\u0435\u0440\u0442\u0438\u0442\u044c, \u0442\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, <em>scope<\/em> \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u0447\u0442\u043e \u043e\u043d\u0430 <em>\u043d\u0435<\/em> \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0434\u0430, \u044d\u0442\u043e \u043d\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <em>\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432<\/em>. \u042d\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <em>\u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439<\/em>. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0430 \u043d\u0435 \u0434\u0435\u043b\u0438\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043b \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043d\u0430 \u0442\u0435 \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0438\u043d\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439, \u0438 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u0432\u0441\u0435 \u043f\u043e\u0434\u0440\u044f\u0434 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0430\u0448\u0443 \u043c\u0430\u0448\u0438\u043d\u0443.<\/li>\n<li>\u0434\u0430, \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u043d\u043e\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 IP \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 GPS-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0430 \u0438\u043c\u0435\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u0438\u0445 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0438.<\/li>\n<li>whois \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u0443\u044e, \u0447\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0430 IP \u0430\u0434\u0440\u0435\u0441\u0430, \u043d\u043e \u0442\u0443\u0442 \u044f \u0431\u044b\u043b \u0441\u0432\u044f\u0437\u0430\u043d \u043b\u0438\u043c\u0438\u0442\u043e\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f Grafan&#8217;\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u044b, \u043d\u043e \u043d\u0435 \u0433\u043e\u0440\u043e\u0434\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"1-pishem-back-end-eksporter-na-go\">1. \u041f\u0438\u0448\u0435\u043c &quot;back-end&quot;: \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u043d\u0430 go<\/h1>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 Prometheus. \u0412\u044b\u0431\u043e\u0440 \u044f\u0437\u044b\u043a\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u0432\u0435\u043b\u0438\u043a: Prometheus \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/clientlibs\/\">\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/a> \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b Go, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043a &quot;\u043d\u0430\u0442\u0438\u0432\u043d\u0435\u0435&quot; (\u0440\u0430\u0437 \u0443\u0436 \u0441\u0430\u043c Prometheus \u043d\u0430 \u043d\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d), \u043d\u0443 \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u0432 \u0441\u0432\u043e\u0435\u0439 DevOps \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0443 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0438\u0440\u0438\u043a\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043a\u043e\u0434\u0443. \u041d\u0430\u0447\u043d\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c &quot;\u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445&quot;: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u044b \u043f\u043e IP \u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 IP \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0432 Prometheus.<\/p>\n<p>  <\/p>\n<h2 id=\"11-opredelyaem-stranu-po-ip-adresu\">1.1. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0443 \u043f\u043e IP \u0430\u0434\u0440\u0435\u0441\u0443<\/h2>\n<p>  <\/p>\n<p>\u041d\u0443 \u0442\u0443\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0441\u0435 \u0432 \u043b\u043e\u0431, \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u043c\u0443\u0434\u0440\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c <a href=\"https:\/\/freegeoip.net\">freegeoip.net<\/a>, API \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0443\u0436\u0435 \u0441\u0442\u0430\u043b deprecated, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c 10,000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0435\u0441\u044f\u0446 (\u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e). \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e: \u0435\u0441\u0442\u044c endpoint \u0432\u0438\u0434\u0430 <code>http:\/\/api.ipstack.com\/&lt;IP&gt;?access_key=&lt;API_KEY&gt;<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442 json \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u043f\u043e\u043b\u0435\u043c <code>country_code<\/code> \u2014 \u044d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<br \/>  \u0418\u0442\u0430\u043a, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u0440\u0433\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u044b \u043f\u043e IP. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043b\u0438\u0431\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 &#39;\u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f&#39; \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 json-\u043e\u0431\u044a\u0435\u043a\u0442.<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">\/\/ Package geo implements function for searching \/\/ for a country code by IP address.  package geo  import (     &quot;encoding\/json&quot;     &quot;fmt&quot;     &quot;io\/ioutil&quot;     &quot;net\/http&quot; )  \/\/ Type GeoIP stores whois info. type GeoIP struct {     Ip          string  `json:&quot;&quot;`     CountryCode string  `json:&quot;country_code&quot;`     CountryName string  `json:&quot;&quot;`     RegionCode  string  `json:&quot;region_code&quot;`     RegionName  string  `json:&quot;region_name&quot;`     City        string  `json:&quot;city&quot;`     Zipcode     string  `json:&quot;zipcode&quot;`     Lat         float32 `json:&quot;latitude&quot;`     Lon         float32 `json:&quot;longitude&quot;`     MetroCode   int     `json:&quot;metro_code&quot;`     AreaCode    int     `json:&quot;area_code&quot;` }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">&#8230;\u0438 \u0441\u0430\u043c\u0443 \u0444\u0443\u043d\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b.<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">\/\/ Function GetCode returns country code by IP address. func GetCode(address string) (string, error) {     response, err = http.Get(&quot;http:\/\/api.ipstack.com\/&quot; + address + &quot;?access_key=&lt;API_KEY&gt;&amp;format=1&amp;legacy=1&quot;)     if err != nil {         fmt.Println(err)         return &quot;&quot;, err     }     defer response.Body.Close()      body, err = ioutil.ReadAll(response.Body)     if err != nil {         fmt.Println(err)         return &quot;&quot;, err     }      err = json.Unmarshal(body, &amp;geo)     if err != nil {         fmt.Println(err)         return &quot;&quot;, err     }      return geo.CountryCode, nil }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>legacy=1<\/code>, \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0442\u0438\u043c\u043e\u0441\u0442\u0438; \u0432\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 API, \u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<h2 id=\"12-formiruem-spisok-tcp-soedineniy\">1.2. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439<\/h2>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u043c <code>github.com\/shirou\/gopsutil\/net<\/code> \u0438 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c <code>ESTABLISHED<\/code>, \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u0437 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e black-\u043b\u0438\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0443 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 IP \u0430\u0434\u0440\u0435\u0441\u0430)<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0430\u043a\u0435\u0442 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u043e\u044e\u0449\u0435\u0439 map[string]int: \u043a\u043e\u043b-\u0432\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043e\u0442 \u0441\u0442\u0440\u0430\u043d\u044b.<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">\/\/ Package conn implements function for collecting \/\/ active TCP connections.  package conn  import (     &quot;log&quot;      &quot;github.com\/gree-gorey\/geoip-exporter\/pkg\/geo&quot;     &quot;github.com\/shirou\/gopsutil\/net&quot; )  \/\/ Type Connections stores map of active connections: country code -&gt; number of connections. type Connections struct {     ConnectionsByCode map[string]int `json:&quot;connections_by_code&quot;` }  \/\/ Function RunJob retrieves active TCP connections. func (c *Connections) RunJob(p *Params) {     if p.UseWg {         defer p.Wg.Done()     }     c.GetActiveConnections(p.BlackList) }  \/\/ Function GetActiveConnections retrieves active TCP connections. func (c *Connections) GetActiveConnections(blackList map[string]bool) {      cs, err := net.Connections(&quot;tcp&quot;)     if err != nil {         log.Println(err)     }      c.ConnectionsByCode = make(map[string]int)     for _, conn := range cs {         if _, ok := blackList[conn.Raddr.IP]; !ok &amp;&amp; (conn.Status == &quot;ESTABLISHED&quot;) &amp;&amp; (conn.Raddr.IP != &quot;127.0.0.1&quot;) {             code, err := geo.GetCode(conn.Raddr.IP)             if code != &quot;&quot; &amp;&amp; err == nil {                 _, ok := c.ConnectionsByCode[code]                 if ok == true {                     c.ConnectionsByCode[code] += 1                 } else {                     c.ConnectionsByCode[code] = 1                 }             }         }      }  }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h2 id=\"13-i-nakonec-otpravlyaem-vse-v-prometheus\">1.3. \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432 Prometheus<\/h2>\n<p>  <\/p>\n<p>\u0422\u043e\u0447\u043d\u0435\u0435, \u043e\u043d \u0441\u0430\u043c \u0432\u0441\u0435 \u0437\u0430\u0431\u0435\u0440\u0435\u0442. \u041f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>github.com\/prometheus\/client_golang\/prometheus<\/code> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0442\u0438\u043f\u0430 <code>Gauge<\/code>. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 <code>Counter<\/code>, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c \u043c\u044b \u0431\u044b \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u043a \u0431\u0430\u0437\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0431\u044b <code>rate<\/code>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f Prometheus \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435, \u043d\u043e \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u044f \u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 (\u043f\u043e\u043b\u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434) \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 Prometheus \u0438 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e <code>Gauge<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">location = prometheus.NewGaugeVec(         prometheus.GaugeOpts{             Name: &quot;job_location&quot;,             Help: &quot;Location connections number&quot;,         },         []string{&quot;location&quot;}, )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0440\u0430\u0432 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0448 \u0432\u0435\u043a\u0442\u043e\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">for code, number := range c.ConnectionsByCode {     location.With(prometheus.Labels{&quot;location&quot;: code}).Set(float64(number)) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435, \u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0438\u043d\u0434\u0438\u043c \u043f\u043e\u0440\u0442 \u0438 \u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0430\u0448\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0437\u0430\u0431\u0435\u0440\u0435\u0442 Prometheus:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">prometheus.MustRegister(location) http.Handle(&quot;\/metrics&quot;, prometheus.Handler()) log.Fatal(http.ListenAndServe(*addr, nil))<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/gree-gorey\/geoip-exporter\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 GitHub<\/a>, \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0434\u0440\u044f\u0434.<\/p>\n<p>  <\/p>\n<h1 id=\"2-front-end-grafana\">2. &quot;Front-end&quot;: Grafana<\/h1>\n<p>  <\/p>\n<p>\u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c Prometheus&#8217;\u0443, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u043b \u043d\u0430\u0448\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code>  - job_name: 'GeoIPExporter'     scrape_interval: 10s     static_configs:       - targets: ['127.0.0.1:9300']<\/code><\/pre>\n<p>  <\/p>\n<p>(\u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f service discovery, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Kubernetes). Prometheus \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433, \u043f\u043e\u0441\u043b\u0430\u0432 \u0435\u043c\u0443 \u0441\u0438\u0433\u043d\u0430\u043b <code>HUP<\/code>:<\/p>\n<p>  <\/p>\n<pre><code>$ pgrep &quot;^prometheus$&quot; | xargs -i kill -HUP {}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0435\u043c\u0443 \u0432 UI \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5g\/h_\/l3\/5gh_l30rao_r6ojiqarwfulix8a.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c Grafan&#8217;\u044b. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c <code>grafana-worldmap-panel<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code>$ grafana-cli plugins install grafana-worldmap-panel<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u043c \u043a \u043d\u0435\u0439 \u0432 UI \u0438 \u0436\u043c\u0435\u043c add panel -&gt; Worldmap Panel. \u0412\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 Metrics \u0432\u0432\u043e\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<p>  <\/p>\n<pre><code>sum(job_location) by (location)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c legend format: <code>{{location}}<\/code>. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cu\/kt\/_i\/cukt_i2hl1ffyfmc8fzh0gez-fg.png\"\/> <\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Worldmap \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043a\u0430\u043a \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435: <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7b\/a3\/5k\/7ba35kxctwe4buw3coyyjtsugnm.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0435! \u041d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u0440\u0442\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u043a\u0430\u0440\u0442\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0432 Grafan&#8217;\u0435. <\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0436\u0434\u0443 \u0432\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"todo\">TODO<\/h2>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u0434\u043e\u0434\u0435\u043b\u0430\u0442\u044c: \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. \u041a\u0441\u0442\u0430\u0442\u0438, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u0438 \u0445\u043e\u0447\u0435\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 GitHub!<\/p>\n<p>  <\/p>\n<h2 id=\"links\">Links<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/clientlibs\/\">Prometheus client libraries<\/a><\/li>\n<li><a href=\"https:\/\/ipstack.com\">Geolocation API<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/shirou\/gopsutil\">psutil for golang<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/grafana\/worldmap-panel\">Worldmap Panel Plugin for Grafana<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/gree-gorey\/geoip-exporter\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub<\/a><\/li>\n<\/ul>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/420633\/\"> https:\/\/habr.com\/post\/420633\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420633\/\" class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gq\/e3\/ss\/gqe3ssl-nxvojbk1gnvm794kihi.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c! <\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0442\u0435\u043c, \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u0434\u043b\u044f Prometheus \u043d\u0430 Golang \u0438 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0442\u0435\u043c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0442\u0435\u043a\u0443\u0449\u0438\u0435 TCP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-288239","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=288239"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288239\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}