{"id":301,"date":"2018-12-05T00:23:28","date_gmt":"2018-12-04T21:23:28","guid":{"rendered":"https:\/\/artem.services\/?p=301"},"modified":"2018-12-18T15:31:46","modified_gmt":"2018-12-18T12:31:46","slug":"prometheus-node-exporter-%d1%83%d1%81%d1%82%d0%b0%d0%bd%d0%be%d0%b2%d0%ba%d0%b0","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=301","title":{"rendered":"Prometheus + Node Exporter &#8212; \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-305\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo.png\" alt=\"\" width=\"1562\" height=\"476\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo.png 1562w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo-300x91.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo-768x234.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo-1024x312.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo-954x291.png 954w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/Prometheus-Logo-1354x413.png 1354w\" sizes=\"(max-width: 1562px) 100vw, 1562px\" \/><\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngroupadd --system prometheus\r\nuseradd -s \/sbin\/nologin --system -g prometheus prometheus\r\n<\/pre>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435:<\/p>\n<p><a href=\"https:\/\/prometheus.io\/download\/\" target=\"_blank\" rel=\"noopener\">https:\/\/prometheus.io\/download\/<\/a><\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwget https:\/\/github.com\/prometheus\/prometheus\/releases\/download\/v2.5.0\/prometheus-2.5.0.linux-amd64.tar.gz\r\n<\/pre>\n<p>\u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntar -xf prometheus-2.5.0.linux-amd64.tar.gz\r\n<\/pre>\n<p><!--more--><\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u043f\u0430\u043f\u043a\u0443:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmv prometheus-2.5.0.linux-amd64 prometheus\r\n<\/pre>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <strong>Prometheus<\/strong> \u0432 &quot;<strong>\/usr\/local\/bin\/<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncp -a prometheus\/prometheus \/usr\/local\/bin\/\r\n<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u043b\u044f <strong>Prometheus<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmkdir \/etc\/prometheus\r\nmkdir \/var\/lib\/prometheus\r\n<\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043f\u043a\u0438 \u0438 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b <strong>Prometheus<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncp -R prometheus\/consoles \/etc\/prometheus\/\r\ncp -R prometheus\/console_libraries \/etc\/prometheus\/\r\ncp prometheus\/prometheus.yml \/etc\/prometheus\/\r\n<\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043f\u0430\u043f\u043a\u0438:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchown -R prometheus:prometheus \/var\/lib\/prometheus\/\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f <strong>Prometheus<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &gt;\/etc\/systemd\/system\/prometheus.service  &lt;&lt; EOF\r\n[Unit]\r\nDescription=Prometheus\r\nDocumentation=https:\/\/prometheus.io\/docs\/introduction\/overview\/\r\nWants=network-online.target\r\nAfter=network-online.target\r\n\r\n[Service]\r\nType=simple\r\nEnvironment=&quot;GOMAXPROCS=2&quot;\r\nUser=prometheus\r\nGroup=prometheus\r\nExecReload=\/bin\/kill -HUP $MAINPID\r\nExecStart=\/usr\/local\/bin\/prometheus \\\r\n  --config.file=\/etc\/prometheus\/prometheus.yml \\\r\n  --storage.tsdb.path=\/var\/lib\/prometheus \\\r\n  --web.console.templates=\/etc\/prometheus\/consoles \\\r\n  --web.console.libraries=\/etc\/prometheus\/console_libraries \\\r\n  --web.listen-address=0.0.0.0:9090 \\\r\n  --web.external-url=\r\n\r\nSyslogIdentifier=prometheus\r\nRestart=always\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\nEOF\r\n<\/pre>\n<p>&quot;<strong>GOMAXPROCS=2<\/strong>&quot; &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440 \u0432 \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/p>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0435\u043c\u043e\u043d\u043e\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl daemon-reload\r\n<\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl enable prometheus\r\nsystemctl start prometheus\r\n<\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043b\u0443\u0436\u0431\u044b:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl status prometheus\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u0421\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a.<\/h3>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c &quot;<strong>node-exporter<\/strong>&quot;<\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435:<\/p>\n<p><a href=\"https:\/\/prometheus.io\/download\/\" target=\"_blank\" rel=\"noopener\">https:\/\/prometheus.io\/download\/<\/a><\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwget https:\/\/github.com\/prometheus\/node_exporter\/releases\/download\/v0.17.0\/node_exporter-0.17.0.linux-amd64.tar.gz\r\n<\/pre>\n<p>\u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntar -xf node_exporter-0.17.0.linux-amd64.tar.gz\r\n<\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 &quot;<strong>\/usr\/local\/bin\/<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncp -a node_exporter-0.17.0.linux-amd64\/node_exporter \/usr\/local\/bin\/\r\n<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f &quot;<strong>Node Exporter<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &gt; \/etc\/systemd\/system\/node_exporter.service &lt;&lt; EOF\r\n[Unit]\r\nDescription=Node Exporter\r\n\r\n[Service]\r\nExecStart=\/usr\/local\/bin\/node_exporter\r\n\r\n[Install]\r\nWantedBy=default.target\r\nEOF\r\n<\/pre>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0435\u043c\u043e\u043d\u043e\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl daemon-reload\r\n<\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl enable node_exporter\r\nsystemctl start node_exporter\r\n<\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043b\u0443\u0436\u0431\u044b:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl status node_exporter\r\n<\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0433\u0434\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d <strong>Prometheus<\/strong>:<\/p>\n<pre>\/etc\/prometheus\/prometheus.yml<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nglobal:\r\n  scrape_interval: &quot;10s&quot;\r\n  evaluation_interval: &quot;10s&quot;\r\n\r\nscrape_configs:\r\n- job_name: &quot;prometheus&quot;\r\n  static_configs:\r\n  - targets: ['localhost:9090']\r\n- job_name: &quot;node&quot;\r\n  static_configs:\r\n  - targets:\r\n    - &quot;localhost:9100&quot;\r\n<\/pre>\n<p>\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0441 \u043d\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a, \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043d\u0438\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c &quot;<strong>node-exporter<\/strong>&quot;:<\/p>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0438\u0445 \u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 <strong>Prometheus<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nscrape_configs:\r\n  - job_name: 'prometheus'\r\n    scrape_interval: 5s\r\n    static_configs:\r\n      - targets: ['web:9100']\r\n        labels:\r\n          host: WEB\r\n      - targets: ['db:9100']\r\n        labels:\r\n          host: DB\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435: https:\/\/prometheus.io\/download\/ \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432: \u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[41],"tags":[78,77],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/301"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=301"}],"version-history":[{"count":7,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/301\/revisions"}],"predecessor-version":[{"id":376,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/301\/revisions\/376"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}