{"id":52686,"date":"2019-11-14T00:00:00","date_gmt":"2019-11-13T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4"},"modified":"2020-02-18T14:00:28","modified_gmt":"2020-02-18T11:00:28","slug":"nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4","status":"publish","type":"post","link":"https:\/\/prohoster.info\/pl\/blog\/administrirovanie\/nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4","title":{"rendered":"Konfigurujemy oficjalny szablon PostgreSQL na Zabbix 4.4.","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Witajcie wszyscy.<\/p>\n<p>W Zabbix pojawi\u0142 si\u0119 oficjalny <b>Szablon DB PostgreSQL<\/b>. W tym artykule skonfigurujemy go w Zabbix 4.4.<\/p>\n<p><img decoding=\"async\" alt=\"Konfigurujemy oficjalny szablon PostgreSQL na Zabbix 4.4.\" src=\"\/wp-content\/uploads\/2019\/11\/6b24a6e1beb87ad6bb0c8b56ae013a7d.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<blockquote><p><b>UWAGA<\/b><\/p>\n<p>Je\u015bli masz dobre umiej\u0119tno\u015bci w j\u0119zyku angielskim, polecam zainstalowa\u0107 szablon wed\u0142ug oficjalnej dokumentacji<\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/zabbix\/zabbix\/tree\/master\/templates\/db\/postgresql\">github.com\/zabbix\/zabbix\/tree\/master\/templates\/db\/postgresql<\/a><\/noindex><\/p>\n<p>Niemniej jednak w moim artykule uwzgl\u0119dnione zosta\u0142y niuanse, kt\u00f3rych nie ma w tym linku.\n<\/p><\/blockquote>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Przygotowanie szablonu<\/h2>\n<p>\n1. Przechodzimy do katalogu domowego.<\/p>\n<pre><code class=\"bash\">cd ~<\/code><\/pre>\n<p>\n2. Pobieramy narz\u0119dzie git i klonujemy oficjalne repozytorium Zabbix, kt\u00f3re znajduje si\u0119 na GitHub.<\/p>\n<pre><code class=\"bash\">yum -y install git\ngit clone https:\/\/github.com\/zabbix\/zabbix.git<\/code><\/pre>\n<p>\n3. Przechodzimy do katalogu z szablonem PostgreSQL.<\/p>\n<pre><code class=\"bash\">cd zabbix\/templates\/db\/postgresql\/<\/code><\/pre>\n<p><\/p>\n<h2>Konfiguracja szablonu dla agenta Zabbix<\/h2>\n<p>\n1. Po\u0142\u0105czymy si\u0119 z PostgreSQL.<\/p>\n<pre><code class=\"bash\">psql -U postgres<\/code><\/pre>\n<p>\n2. Utworzymy u\u017cytkownika zbx_monitor tylko do odczytu z dost\u0119pem do serwera PostgreSQL.<\/p>\n<p>Dla wersji PostgreSQL 10 i wy\u017cszej:<\/p>\n<pre><code class=\"bash\">CREATE USER zbx_monitor WITH PASSWORD '' INHERIT; GRANT pg_monitor TO zbx_monitor;<\/code><\/pre>\n<p>\nDla wersji PostgreSQL 9.6 i ni\u017cszej:<\/p>\n<pre><code class=\"bash\">CREATE USER zbx_monitor WITH PASSWORD '';\nGRANT SELECT ON pg_stat_database TO zbx_monitor;\n\n--Aby zbiera\u0107 metryki WAL, u\u017cytkownik musi by\u0107 superu\u017cytkownikiem.\nALTER USER zbx_monitor WITH SUPERUSER;<\/code><\/pre>\n<p>\n3. Skopiujemy katalog postgresql\/ do katalogu \/var\/lib\/zabbix\/. Je\u015bli w \/var\/lib\/ nie ma katalogu zabbix\/, utw\u00f3rz go. Katalog postgresql\/ zawiera pliki potrzebne do pozyskiwania metryk z PostgreSQL.<\/p>\n<pre><code class=\"bash\">cp -r postgresql\/ \/var\/lib\/zabbix\/<\/code><\/pre>\n<p>\n4. Nast\u0119pnie skopiujemy plik template_db_postgresql.conf do katalogu konfiguracji agenta Zabbix \/etc\/zabbix\/zabbix_agentd.d\/ i uruchomimy ponownie agenta Zabbix.<\/p>\n<pre><code class=\"bash\">cp template_db_postgresql.conf \/etc\/zabbix\/zabbix_agentd.d\/<\/code><\/pre>\n<p>\n5. Teraz edytujemy plik pg_hba.conf, aby zezwoli\u0107 na po\u0142\u0105czenie z Zabbix. Wi\u0119cej o pliku pg_hba.conf: <noindex><a rel=\"nofollow\" href=\"https:\/\/www.postgresql.org\/docs\/current\/auth-pg-hba-conf.html\">https:\/\/www.postgresql.org\/docs\/current\/auth-pg-hba-conf.html<\/a><\/noindex>.<\/p>\n<p>Otw\u00f3rz plik:<\/p>\n<pre><code class=\"bash\">vi \/var\/lib\/pgsql\/12\/data\/pg_hba.conf<\/code><\/pre>\n<p>\nDodaj jedn\u0105 z linii (je\u015bli nie rozumiesz, czemu to potrzebne, dodaj tylko pierwsz\u0105 lini\u0119):<\/p>\n<pre><code class=\"bash\">host all zbx_monitor 127.0.0.1\/32 trust\nhost all zbx_monitor 0.0.0.0\/0 md5\nhost all zbx_monitor ::0\/0 md5<\/code><\/pre>\n<blockquote><p><b>UWAGA<\/b><\/p>\n<p>Je\u015bli PostgreSQL zosta\u0142 zainstalowany z repozytorium PGDG, dodaj \u015bcie\u017ck\u0119 do pg_isready do zmiennej \u015brodowiskowej PATH dla u\u017cytkownika zabbix.<\/p>\n<p><b>Na przyk\u0142ad:<\/b><\/p>\n<pre><code class=\"bash\">ln -s \/usr\/pgsql-12\/bin\/pg_isready \/usr\/bin\/pg_isready<\/code><\/pre>\n<p>\n<i>* \u2014 poniewa\u017c mam wersj\u0119 pgsql 12, u Ciebie zamiast pgsql-12 b\u0119dzie inna \u015bcie\u017cka.<\/i><\/p>\n<p>Je\u015bli tego nie zrobisz, Status: Ping zawsze b\u0119dzie w stanie Down.\n<\/p><\/blockquote>\n<p><\/p>\n<h2>Dodanie szablonu na frontendzie Zabbix<\/h2>\n<p>\nUwa\u017cam, \u017ce ci, kt\u00f3rzy potrzebuj\u0105 zbiera\u0107 metryki z PostgreSQL, wiedz\u0105 ju\u017c, jak dodawa\u0107 szablony. Dlatego opisz\u0119 proces kr\u00f3tko.<\/p>\n<ol>\n<li>Przechodzimy na stron\u0119 Zabbix;<\/li>\n<li>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 &#171;<b>Konfiguracja<\/b>&#187; =&gt; &#171;<b>Host<\/b>\u201e;<\/li>\n<li>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<b>Utw\u00f3rz host<\/b>&#187; \u0438\u043b\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0441\u0442;<\/li>\n<li>\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0445\u043e\u0441\u0442\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u043a\u043b\u0430\u0434\u043a\u0443 &#171;<b>Szablony<\/b>&#187; \u0438 \u0438 \u0436\u043c\u0451\u043c \u043d\u0430 \u043b\u0438\u043d\u043a &#171;<b>Dodaj<\/b>\u201e;<\/li>\n<li>\u0412 \u00abGroup\u00bb \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u00abTemplates\/Databases\u00bb, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d &#171;<b>Szablon DB PostgreSQL<\/b>&#171;, \u0436\u043c\u0451\u043c \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<b>Select<\/b>&#187; \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<b>Update<\/b>\u201e;<\/li>\n<\/ol>\n<p>\n\u0416\u0434\u0451\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 &#171;<b>Monitoring<\/b>&#187; =&gt; &#171;<b>Naj\u015bwie\u017csze dane<\/b>&#187; =&gt; &#171;<b>Hosts<\/b>&#187; \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 PostgreSQL =&gt; \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c &#171;<b>Apply<\/b>&#171;. <\/p>\n<p><img decoding=\"async\" alt=\"Konfigurujemy oficjalny szablon PostgreSQL na Zabbix 4.4.\" src=\"\/wp-content\/uploads\/2019\/11\/6f01ce3c9db0813b0c73517f98b3d385.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nMi\u0142ej lektury!<br \/>\n<br \/>\u0179r\u00f3d\u0142o: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/475604\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0412 Zabbix \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Template DB PostgreSQL. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0435\u0433\u043e \u0432 Zabbix 4.4. \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415 \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u043c, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u0430\u043d\u0443\u0430\u043b\u0443 github.com\/zabbix\/zabbix\/tree\/master\/templates\/db\/postgresql \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443\u0447\u0442\u0435\u043d\u044b \u043d\u044e\u0430\u043d\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u043f\u043e \u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 1. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433. cd ~ [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-52686","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0412 Zabbix \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Template DB PostgreSQL.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/pl\/blog\/administrirovanie\/nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"pl_PL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d PostgreSQL \u043d\u0430 Zabbix 4.4 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0412 Zabbix \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Template DB PostgreSQL.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/pl\/blog\/administrirovanie\/nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-11-13T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T11:00:28+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Konfigurujemy oficjalny szablon PostgreSQL w Zabbix 4.4 | ProHoster","description":"Cze\u015b\u0107 wszystkim. W Zabbix pojawi\u0142 si\u0119 oficjalny Template DB PostgreSQL.","canonical_url":"https:\/\/prohoster.info\/pl\/blog\/administrirovanie\/nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"pl_PL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d PostgreSQL \u043d\u0430 Zabbix 4.4 | ProHoster","og:description":"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0412 Zabbix \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Template DB PostgreSQL.","og:url":"https:\/\/prohoster.info\/pl\/blog\/administrirovanie\/nastraivaem-ofitsialnyj-shablon-postgresql-na-zabbix-4-4","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-11-13T21:00:00+00:00","article:modified_time":"2020-02-18T11:00:28+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"52686","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 04:27:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 20:39:25","updated":"2026-01-24 04:27:20","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/posts\/52686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/comments?post=52686"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/posts\/52686\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/media?parent=52686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/categories?post=52686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/pl\/wp-json\/wp\/v2\/tags?post=52686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}