{"id":38253,"date":"2019-10-31T22:22:35","date_gmt":"2019-10-31T19:22:35","guid":{"rendered":"https:\/\/prohoster.info\/blog\/monitoring-postgres-vnutri-openshift\/"},"modified":"2019-10-31T22:22:35","modified_gmt":"2019-10-31T19:22:35","slug":"monitoring-postgres-vnutri-openshift","status":"publish","type":"post","link":"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/monitoring-postgres-vnutri-openshift","title":{"rendered":"Postgresi j\u00e4lgimine Openshiftis","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Tere, Habra elanikud!<\/p>\n<p>T\u00e4na tahan r\u00e4\u00e4kida teile, kuidas me soovisime monitoorida Postgres'i ja veel paar objekti OpenShift'i klastris ning kuidas me seda tegime.<\/p>\n<p>Sisendiks oli meil:<\/p>\n<ul>\n<li>OpenShift<\/li>\n<li>Helm<\/li>\n<li>Prometheus<\/li>\n<\/ul>\n<p>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nJava rakenduse kasutamine oli \u00fcsna lihtne ja l\u00e4bipaistev, t\u00e4psemalt \u00f6eldes:<\/p>\n<p>1) Lisamine failile build.gradle <\/p>\n<pre><code class=\"plaintext\"> implementation \"io.micrometer:micrometer-registry-prometheus\"<\/code><\/pre>\n<p>\n2) Prometheuse k\u00e4ivitamine konfigureerimisega <\/p>\n<pre><code class=\"xml\"> - job_name: 'job-name'\n    metrics_path: 'actuator\/prometheus'\n    scrape_interval: 5s\n    kubernetes_sd_configs:\n    - role: pod\n      namespaces:\n        names:\n          - 'name'<\/code><\/pre>\n<p>\n3) Kuvamise lisamine Grafanas <\/p>\n<p>K\u00f5ik oli \u00fcsna lihtne ja arusaadav, kuni saabus hetk, mil pidime monitoorima andmebaase, mis asuvad meie l\u00e4hedal nimiruumis (jah, see on halb, keegi ei tee nii, aga miski ei ole t\u00e4iuslik).<\/p>\n<h3>Kuidas see toimib? <\/h3>\n<p>\nLisaks Postgres'i pod'ile ja Prometheusele on meil vajalik veel \u00fcks objekt \u2014 eksporter.<\/p>\n<p>Eksporter on abstraktses m\u00f5ttes agent, mis kogub metrikat rakenduselt v\u00f5i isegi <a class=\"wpil_keyword_link\" href=\"https:\/\/prohoster.info\/et\/server\/dts-los-angeles\/\"   title=\"serverilt\" data-wpil-keyword-link=\"linked\"  data-wpil-monitor-id=\"3521\">serverilt<\/a>. Postgres'i ekspoorter on kirjutatud Go-s, see t\u00f6\u00f6tab p\u00f5him\u00f5ttel, et k\u00e4ivitab SQL skripte andmebaasis ja kogub seej\u00e4rel saadaolevad tulemused Prometheusele. See v\u00f5imaldab ka kogutavaid meetrikaid laiendada, lisades oma.<\/p>\n<p>Deployime selle j\u00e4rgmise viisi j\u00e4rgi (n\u00e4idis deployment.yaml, mitte millegagi siduv):<\/p>\n<pre><code class=\"xml\">\n---\napiVersion: extensions\/v1beta1\nkind: Deployment\nmetadata:\n  name: postgres-exporter\n  labels:\n    app: {{ .Values.name }}\n    monitoring: prometheus\nspec:\n  serviceName: {{ .Values.name }}\n  replicas: 1\n  revisionHistoryLimit: 5\n  template:\n    metadata:\n      labels:\n        app: postgres-exporter\n        monitoring: prometheus\n    spec:\n      containers:\n      - env:\n        - name: DATA_SOURCE_URI\n          value: postgresdb:5432\/pstgr?sslmode=disable\n        - name: DATA_SOURCE_USER\n          value: postgres\n        - name: DATA_SOURCE_PASS\n          value: postgres\n        resources:\n          limits:\n            cpu: 100m\n            memory: 50Mi\n          requests:\n            cpu: 100m\n            memory: 50Mi\n        livenessProbe:\n          tcpSocket:\n            port: metrics\n          initialDelaySeconds: 30\n          periodSeconds: 30\n        readinessProbe:\n          tcpSocket:\n            port: metrics\n          initialDelaySeconds: 10\n          periodSeconds: 30\n        image: exporter\n        name: postgres-exporter\n        ports:\n        - containerPort: 9187\n          name: metrics<\/code><\/pre>\n<p>\nSamuti on vaja teenust ja imid\u017eivoogu<\/p>\n<p>P\u00e4rast deploymist tahame, et k\u00f5ik \u00fcksteist n\u00e4eksid.<\/p>\n<p>Lisame Prometheuse konfiguraatorisse j\u00e4rgmise l\u00f5igu:<\/p>\n<pre><code class=\"xml\">  - job_name: 'postgres_exporter'\n    metrics_path: '\/metrics'\n    scrape_interval: 5s\n    dns_sd_configs:\n    - names:\n      - 'postgres-exporter'\n      type: 'A'\n      port: 9187<\/code><\/pre>\n<p>\nJa siin hakkas k\u00f5ik t\u00f6\u00f6le, j\u00e4i vaid k\u00f5ik see Grafanasse lisada ja nautida tulemust.<\/p>\n<p>Lisaks oma p\u00e4ringute lisamise v\u00f5imalusele saab Prometheuses muuta seadistusi, et koguda vajalikud m\u00f5\u00f5dikud veelgi sihip\u00e4rasemalt.<\/p>\n<p>Analoge meetodit kasutati j\u00e4rgnevate jaoks:<\/p>\n<ul>\n<li>Kafka<\/li>\n<li>Elasticsearch<\/li>\n<li>Mongo<\/li>\n<\/ul>\n<p>\nP.S. K\u00f5ik andmed nimede, portide ja muu osas on v\u00e4lja m\u00f5eldud ja ei kanna mingit teavet. <\/p>\n<p>Kasulikud lingid:<br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\">Erinevate eksportijate nimekiri<\/a><\/noindex><br \/>\n<br \/>Allikas: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/467915\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a \u0436\u0438\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c postgres \u0438 \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 OpenShift \u0438 \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u043b\u0438: Openshift Helm Prometheus \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e, \u0430 \u0435\u0441\u043b\u0438 \u0431\u044b\u0442\u044c \u0442\u043e\u0447\u043d\u0435\u0435, \u0442\u043e: 1) \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 build.gradle implementation &#171;io.micrometer:micrometer-registry-prometheus&#187; [&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-38253","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=\"\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a \u0436\u0438\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c postgres \u0438 \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 OpenShift \u0438 \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u043b\u0438: .\" \/>\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\/et\/blog\/administrirovanie\/monitoring-postgres-vnutri-openshift\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"et_EE\" \/>\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\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 postgres \u0432\u043d\u0443\u0442\u0440\u0438 Openshift | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a \u0436\u0438\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c postgres \u0438 \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 OpenShift \u0438 \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u043b\u0438: .\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/monitoring-postgres-vnutri-openshift\" \/>\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-10-31T19:22:35+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:22:35+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\udd47PostgreSQL-i j\u00e4lgimine Openshift'is | ProHoster","description":"Tere, Habr elanikud! T\u00e4na tahan r\u00e4\u00e4kida sellest, kuidas me v\u00e4ga soovisime PostgreSQL-i t\u00f5husalt j\u00e4lgida ja veel m\u00f5nda \u00fcksust OpenShift'i klastris ning kuidas me seda tegime. Sissep\u00e4\u00e4suks oli meil:","canonical_url":"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/monitoring-postgres-vnutri-openshift","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"et_EE","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\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 postgres \u0432\u043d\u0443\u0442\u0440\u0438 Openshift | ProHoster","og:description":"\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a \u0436\u0438\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c postgres \u0438 \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 OpenShift \u0438 \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u043b\u0438: .","og:url":"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/monitoring-postgres-vnutri-openshift","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-10-31T19:22:35+00:00","article:modified_time":"2019-10-31T19:22:35+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"38253","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-02-22 15:56:24","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:12:23","updated":"2026-02-22 15:56:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts\/38253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/comments?post=38253"}],"version-history":[{"count":1,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts\/38253\/revisions"}],"predecessor-version":[{"id":162047,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts\/38253\/revisions\/162047"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/media?parent=38253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/categories?post=38253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/tags?post=38253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}