{"id":364170,"date":"2024-05-21T02:11:36","date_gmt":"2024-05-21T02:11:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=364170"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=364170","title":{"rendered":"<span>\u041f\u0440\u043e\u0435\u043a\u0442 \u044e\u043d\u043e\u0433\u043e DevOps \u0413\u043b\u0430\u0432\u0430 4: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/adb\/6fe\/3d5\/adb6fe3d5a8668be23dfda4fb097619e.png\" width=\"1440\" height=\"816\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/adb\/6fe\/3d5\/adb6fe3d5a8668be23dfda4fb097619e.png\"\/><\/figure>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u043f\u0438\u0441\u0430\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e pet-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430 \u0432 DevOps:<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/781746\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 1: \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043d\u0434\u0430<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/789056\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 2: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0446\u0435\u043d\u0442\u0440\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/783304\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 3: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenVPN<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/783572\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 4: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/strong><\/a><\/p>\n<blockquote>\n<p>\u0414\u0440\u0443\u0437\u044c\u044f, \u0445\u043e\u0447\u0443 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 DevOps &#8212; Terraform, Ansible, Kubernetes, GitLab CI\/CD \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e DevOps \u0431\u0435\u0437 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442.<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 DevOps \u0438 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u0417\u0434\u0435\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0430\u043a\u0446\u0435\u043d\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e pet-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 &#8212; \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0441 Linux \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 DevOps &#8212; \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00ab\u041f\u0440\u043e\u0435\u043a\u0442\u00a0<strong>\u044e\u043d\u043e\u0433\u043e<\/strong>\u00a0DevOps\u00bb. \u0412 \u043f\u043b\u0430\u043d\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0443\u0436\u0435 \u0441 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u0435\u043c \u0432 DevOps \u0438 \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u0442\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e. \u041f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u043e\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043d\u0438\u0435, \u0432\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0434\u043d\u044f!<\/p>\n<\/blockquote>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Prometheus<\/h2>\n<p>Prometheus \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439, \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0435 \u0438\u0437 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u0432 Time Series Database (TSDB). \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SQl-like \u0421\u0423\u0411\u0414, Prometheus \u0441\u0430\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0445\u043e\u0441\u0442\u0430\u043c. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u0432 Prometheus \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441 PromQL. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0438\u043b\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0435.<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c bash-\u0441\u043a\u0440\u0438\u043f\u0442 \u00abvm-start.sh\u00bb \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 Prometheus:<\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Prometheus \u0432\u0435\u0440\u0441\u0438\u0438 2.47.0 c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/prometheus\/prometheus\/releases\/download\/v2.47.0\/prometheus-2.47.0.linux-amd64.tar.gz tar xvf ~\/prometheus-2.47.0.linux-amd64.tar.gz &amp;&amp; cd ~\/prometheus-2.47.0.linux-amd64 sudo cp prometheus \/usr\/bin\/ sudo cp promtool \/usr\/bin\/ sudo ln -s \/usr\/bin\/prometheus \/usr\/local\/bin\/prometheus sudo ln -s \/usr\/bin\/promtool \/usr\/local\/bin\/promtool sudo mkdir \/etc\/prometheus sudo cp prometheus.yml \/etc\/prometheus sudo cp -r consoles \/etc\/prometheus sudo cp -r console_libraries \/etc\/prometheus sudo mkdir \/var\/lib\/prometheus<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Prometheus \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439<\/h3>\n<p>\u041d\u0430 vm \u00abca\u00bb <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#issue\" rel=\"noopener noreferrer nofollow\">\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c<\/a> \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u00ab<em>\/etc\/prometheus<\/em>\u00bb:<\/p>\n<pre><code class=\"bash\">sudo cp ~\/monitor.justnikobird.ru.crt \/etc\/prometheus\/ sudo cp ~\/monitor.justnikobird.ru.key \/etc\/prometheus\/<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0445\u044d\u0448 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f &#8212; \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u00abpassword\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abadmin\u00bb:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y apache2-utils htpasswd -nbB -C 10 admin \"password\"<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"bash\">admin:$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u00ab<em>\/etc\/prometheus\/web.yml<\/em>\u00bb, \u043a\u0443\u0434\u0430 \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 https:<\/p>\n<pre><code class=\"bash\">tls_server_config:   # Certificate and key files for server to use to authenticate to client.   cert_file: monitor.justnikobird.ru.crt   key_file: monitor.justnikobird.ru.key  basic_auth_users:   admin: '$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS'<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u00abprometheus\u00bb \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo addgroup --system \"prometheus\" --quiet sudo adduser --system --home \/usr\/share\/prometheus --no-create-home --ingroup \"prometheus\" --disabled-password --shell \/bin\/false \"prometheus\"<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417&#187;>\u0422\u0423\u0417<\/abbr> \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chown -R prometheus:prometheus \/var\/lib\/prometheus\/ sudo chmod -R 755 \/var\/lib\/prometheus\/ sudo chown -R prometheus:prometheus \/etc\/prometheus\/ sudo chmod -R 755 \/etc\/prometheus\/ sudo chmod 640 \/etc\/prometheus\/*.crt sudo chmod 640 \/etc\/prometheus\/*.key sudo chown prometheus:prometheus \/usr\/bin\/prometheus sudo chown -h prometheus:prometheus \/usr\/local\/bin\/prometheus sudo chmod 755 \/usr\/bin\/prometheus sudo chown prometheus:prometheus \/usr\/bin\/promtool sudo chown -h prometheus:prometheus \/usr\/local\/bin\/promtool sudo chmod 755 \/usr\/bin\/promtool<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h3>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/prometheus.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Prometheus:<\/p>\n<pre><code class=\"bash\">[Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=\/usr\/bin\/prometheus \\ --config.file \/etc\/prometheus\/prometheus.yml \\ --storage.tsdb.path \/var\/lib\/prometheus\/ \\ --web.console.templates=\/etc\/prometheus\/consoles \\ --web.console.libraries=\/etc\/prometheus\/console_libraries \\ --web.config.file=\/etc\/prometheus\/web.yml [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Prometheus \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart prometheus.service sudo systemctl enable prometheus.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Prometheus \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9090.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp --dport 9090 -j ACCEPT -m comment --comment prometheus<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u00ab<a href=\"https:\/\/monitor.justnikobird.ru:9090\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/monitor.justnikobird.ru:9090<\/strong><\/a><strong>\u00bb <\/strong>\u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Prometheus \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<hr\/>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432<\/h2>\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u044b Prometheus \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0435\u043d Prometheus. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 Prometheus \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Node Exporter<\/h3>\n<p>Node Exporter &#8212; \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0443\u0437\u043b\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0443\u0437\u043b\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CPU, \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0430 \u0432\u0441\u0435 vm \u0441\u0442\u0435\u043d\u0434\u0430.<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u0438 \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Node Exporter \u0432\u0435\u0440\u0441\u0438\u0438 1.6.1  c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/prometheus\/node_exporter\/releases\/download\/v1.6.1\/node_exporter-1.6.1.linux-amd64.tar.gz tar xvf ~\/node_exporter-1.6.1.linux-amd64.tar.gz &amp;&amp; cd ~\/node_exporter-1.6.1.linux-amd64 sudo cp node_exporter \/usr\/bin\/ sudo mkdir \/opt\/node_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Node Exporter \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/p>\n<\/div>\n<\/details>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439<\/h4>\n<p>\u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0440\u0430\u043d\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#issue\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e<\/a> \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f vm \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430:<\/p>\n<pre><code>sudo cp ~\/example.justnikobird.ru.crt \/opt\/node_exporter\/ sudo cp ~\/example.justnikobird.ru.key \/opt\/node_exporter\/<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0445\u044d\u0448 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f &#8212; \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u00abpassword\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abadmin\u00bb:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y apache2-utils htpasswd -nbB -C 10 admin \"password\"<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"bash\">admin:$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u00ab<em>\/opt\/node_exporter\/web.yml<\/em>\u00bb, \u043a\u0443\u0434\u0430 \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 https:<\/p>\n<pre><code class=\"bash\">tls_server_config:   # Certificate and key files for server to use to authenticate to client.   cert_file: example.justnikobird.ru.crt   key_file: example.justnikobird.ru.key  basic_auth_users:   admin: '$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS'<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u00abnode_exporter\u00bb \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo addgroup --system \"node_exporter\" --quiet sudo adduser --system --home \/usr\/share\/prometheus --no-create-home --ingroup \"node_exporter\" --disabled-password --shell \/bin\/false \"node_exporter\"<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417&#187;>\u0422\u0423\u0417<\/abbr> \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chmod 755 \/usr\/bin\/node_exporter sudo chown node_exporter:node_exporter \/usr\/bin\/node_exporter sudo chmod -R 755 \/opt\/node_exporter\/ sudo chmod 640 \/opt\/node_exporter\/*.crt sudo chmod 640 \/opt\/node_exporter\/*.key sudo chown -R node_exporter:node_exporter \/opt\/node_exporter\/<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h4>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/node_exporter.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Node Exporter:<\/p>\n<pre><code class=\"bash\">[Unit] Description=Prometheus Node Exporter Wants=network-online.target After=network-online.target  [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=\/usr\/bin\/node_exporter --web.config.file=\/opt\/node_exporter\/web.yml  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Node Exporter \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart node_exporter.service sudo systemctl enable node_exporter.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9100<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h4>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u0438\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 <a href=\"https:\/\/habr.com\/ru\/articles\/781746\/#vm_info\" rel=\"noopener noreferrer nofollow\">\u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/a> \u00ab10.0.0.6\u00bb:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp -s 10.0.0.6 --dport 9100 -j ACCEPT -m comment --comment prometheus_node_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0435\u043d\u0434\u0435.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0430 deb-\u043f\u0430\u043a\u0435\u0442\u0430 Node Exporter<\/h4>\n<p>\u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/783076\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 DEB-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438<\/strong><\/a>\u00bb. <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u0447\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442\u0435:<\/p>\n<pre><code class=\"bash\">\/opt\/node_exporter\/web.yml \/usr\/bin\/node_exporter \/etc\/systemd\/system\/node_exporter.service<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>install<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">web.yml opt\/node_exporter\/ node_exporter usr\/bin\/ node_exporter.service etc\/systemd\/system\/<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>control<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">Source: node-exporter-lab Section: unknown Priority: optional Maintainer: unknown &lt;nikolay@unknown> Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.0 Homepage: &lt;insert the upstream URL, if relevant> #Vcs-Browser: https:\/\/salsa.debian.org\/debian\/just-node-exporter #Vcs-Git: https:\/\/salsa.debian.org\/debian\/just-node-exporter.git Rules-Requires-Root: no  Package: node-exporter-lab Architecture: all Depends: ${misc:Depends} Description: &lt;insert up to 60 chars description>  &lt;insert long description, indented with spaces><\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>postinst<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  set -e  USER=\"node_exporter\" GROUP=\"node_exporter\"  if ! getent group \"$GROUP\" > \/dev\/null 2>&amp;1 ; then   addgroup --system \"$GROUP\" --quiet fi  if ! id \"$USER\" > \/dev\/null 2>&amp;1 ; then   adduser --system --home \/usr\/share\/prometheus --no-create-home \\   --ingroup \"$GROUP\" --disabled-password --shell \/bin\/false \\   \"$USER\" fi  chown -R $USER:$GROUP \/opt\/node_exporter chmod -R 755 \/opt\/node_exporter chown $USER:$GROUP \/usr\/bin\/node_exporter chmod 755 \/usr\/bin\/node_exporter  echo -n \"Restarting node_exporter service...\"  if command -v systemctl >\/dev\/null; then   systemctl daemon-reload || true   systemctl enable node_exporter.service || true   systemctl restart node_exporter.service || true   systemctl restart node_exporter.service || true fi echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>prerm<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  echo 'Stopping and disabling node_exporter service...'  if command -v systemctl >\/dev\/null; then   systemctl stop node_exporter.service || true   systemctl disable node_exporter.service || true fi  userdel node_exporter >\/dev\/null 2>&amp;1 || true groupdel node_exporter >\/dev\/null 2>&amp;1 || true  echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u00a0\u00ab<strong><em>node-exporter-lab_0.1-1_all.deb<\/em><\/strong>\u00bb.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#repo_upload\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c<\/a> \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.  <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenVPN Exporter<\/h3>\n<p>OpenVPN Exporter &#8212; \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c Prometheus \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 OpenVPN. \u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u0445, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 OpenVPN.  <\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abvpn\u00bb \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u044f\u0437\u044b\u043a\u0430 Go:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y golang<\/code><\/pre>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b OpenVPN Exporter \u0432\u0435\u0440\u0441\u0438\u0438 0.3.0 c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/kumina\/openvpn_exporter\/archive\/refs\/tags\/v0.3.0.tar.gz tar xvf v0.3.0.tar.gz &amp;&amp; cd ~\/openvpn_exporter-0.3.0<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 OpenVPN Exporter \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u00abopenvpnStatusPaths\u00bb \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u00ab<em>~\/openvpn_exporter-0.3.0\/main.go<\/em>\u00bb \u0443\u043a\u0430\u0436\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u043b\u043e\u0433-\u0444\u0430\u043b\u0430 OpenVPN:<\/p>\n<pre><code class=\"bash\">openvpnStatusPaths = flag.String(\"openvpn.status_paths\", \"\/var\/log\/openvpn\/openvpn-status.log\", \"Paths at which OpenVPN places its status files.\")<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo go build ~\/openvpn_exporter-0.3.0\/main.go<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u00ab<em>main<\/em>\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u00ab<em>\/usr\/bin<\/em>\u00bb:<\/p>\n<pre><code class=\"bash\">sudo cp ~\/openvpn_exporter-0.3.0\/main \/usr\/bin\/openvpn_exporter<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u00abopenvpn_exporter\u00bb \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo addgroup --system \"openvpn_exporter\" --quiet sudo adduser --system --home \/usr\/share\/openvpn_exporter --no-create-home --ingroup \"openvpn_exporter\" --disabled-password --shell \/bin\/false \"openvpn_exporter\"<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u00abopenvpn_exporter\u00bb \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb:<\/p>\n<pre><code class=\"bash\">sudo usermod -a -G openvpn_exporter root<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u043e\u043c OpenVPN:<\/p>\n<pre><code class=\"bash\">sudo chgrp openvpn_exporter \/var\/log\/openvpn\/openvpn-status.log sudo chmod 660 \/var\/log\/openvpn\/openvpn-status.log<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417&#187;>\u0422\u0423\u0417<\/abbr> \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chown openvpn_exporter:openvpn_exporter \/usr\/bin\/openvpn_exporter sudo chmod 755 \/usr\/bin\/openvpn_exporter<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h4>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/openvpn_exporter.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 OpenVPN Exporter:<\/p>\n<pre><code class=\"bash\">[Unit] Description=Prometheus OpenVPN Node Exporter Wants=network-online.target After=network-online.target  [Service] User=openvpn_exporter Group=openvpn_exporter Type=simple ExecStart=\/usr\/bin\/openvpn_exporter  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c OpenVPN Exporter \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart openvpn_exporter.service sudo systemctl enable openvpn_exporter.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9176 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 http.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h4>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u0438\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/781746\/#vm_info\" rel=\"noopener noreferrer nofollow\">\u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/a>\u00a0\u00ab10.0.0.6\u00bb:  <\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp -s 10.0.0.6 --dport 9176 -j ACCEPT -m comment --comment prometheus_openvpn_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0435\u043d\u0434\u0435.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0430 deb-\u043f\u0430\u043a\u0435\u0442\u0430 OpenVPN Exporter<\/h4>\n<p>\u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/783076\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 DEB-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438<\/strong><\/a>\u00bb.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u0447\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442\u0435:<\/p>\n<pre><code class=\"bash\">\/usr\/bin\/openvpn_exporter \/etc\/systemd\/system\/openvpn_exporter.service<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>install<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">openvpn_exporter usr\/bin\/ openvpn_exporter.service etc\/systemd\/system\/<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>control<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">Source: openvpn-exporter-lab Section: unknown Priority: optional Maintainer: unknown &lt;nikolay@unknown> Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.0 Homepage: &lt;insert the upstream URL, if relevant> #Vcs-Browser: https:\/\/salsa.debian.org\/debian\/just-open-vpn-exporter #Vcs-Git: https:\/\/salsa.debian.org\/debian\/just-open-vpn-exporter.git Rules-Requires-Root: no  Package: openvpn-exporter-lab Architecture: all Depends: ${misc:Depends} Description: &lt;insert up to 60 chars description>  &lt;insert long description, indented with spaces><\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>postinst<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  set -e  USER=\"openvpn_exporter\" GROUP=\"openvpn_exporter\" OPENVPN_LOGFILE=\"\/var\/log\/openvpn\/openvpn-status.log\"  if ! getent group \"$GROUP\" > \/dev\/null 2>&amp;1 ; then   addgroup --system \"$GROUP\" --quiet fi  if ! id \"$USER\" > \/dev\/null 2>&amp;1 ; then   adduser --system --home \/usr\/share\/prometheus --no-create-home \\   --ingroup \"$GROUP\" --disabled-password --shell \/bin\/false \\   \"$USER\" fi  sudo usermod -a -G openvpn_exporter root  if [ -f \"$OPENVPN_LOGFILE\" ]; then   sudo chgrp $GROUP $OPENVPN_LOGFILE   sudo chmod 660 $OPENVPN_LOGFILE fi  chown $USER:$GROUP \/usr\/bin\/openvpn_exporter chmod 755 \/usr\/bin\/openvpn_exporter  echo -n \"Restarting openvpn-exporter service...\"  if command -v systemctl >\/dev\/null; then   systemctl daemon-reload || true   systemctl enable openvpn_exporter.service || true   systemctl restart openvpn_exporter.service || true fi  echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>prerm<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  USER=\"openvpn_exporter\" GROUP=\"openvpn_exporter\" OPENVPN_LOGFILE=\"\/var\/log\/openvpn\/openvpn-status.log\"  echo 'Stopping and disabling openvpn-exporter service...'  if command -v systemctl >\/dev\/null; then   systemctl stop openvpn_exporter.service || true   systemctl disable openvpn_exporter.service || true fi  if [ -f \"$OPENVPN_LOGFILE\" ]; then   sudo chgrp root $OPENVPN_LOGFILE   sudo chmod 640 $OPENVPN_LOGFILE fi  userdel $USER >\/dev\/null 2>&amp;1 || true groupdel $GROUP >\/dev\/null 2>&amp;1 || true  echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u00a0\u00ab<strong><em>openvpn-exporter-lab_0.1-1_all.deb<\/em><\/strong>\u00bb.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#repo_upload\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c<\/a> \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Nginx Exporter<\/h3>\n<p>Nginx Exporter \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 Nginx.<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abrepo\u00bb \u0438 \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Nginx Exporter \u0432\u0435\u0440\u0441\u0438\u0438 0.11.0 c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/nginxinc\/nginx-prometheus-exporter\/releases\/download\/v0.11.0\/nginx-prometheus-exporter_0.11.0_linux_amd64.tar.gz mkdir ~\/nginx-prometheus-exporter_0.11.0_linux_amd64 tar xvf nginx-prometheus-exporter_0.11.0_linux_amd64.tar.gz -C ~\/nginx-prometheus-exporter_0.11.0_linux_amd64 &amp;&amp; cd ~\/nginx-prometheus-exporter_0.11.0_linux_amd64 sudo cp nginx-prometheus-exporter \/usr\/bin\/ sudo mkdir \/opt\/nginx_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Nginx Exporter \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/p>\n<\/div>\n<\/details>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Nginx<\/h4>\n<p>\u0412\u0430\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0432 Nginx.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 Nginx \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"bash\">server {         listen 8080;          location \/stub_status {                 stub_status;                 allow 127.0.0.1;                 deny all;         } }<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Nginx \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">server {         listen 1111 ssl default_server;         server_name repo.justnikobird.ru;         auth_basic              \"Restricted Access!\";         auth_basic_user_file    \/etc\/nginx\/conf.d\/.htpasswd;         ssl_certificate     repo.justnikobird.ru.crt;         ssl_certificate_key repo.justnikobird.ru.key;         ssl_protocols       TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;         ssl_ciphers         HIGH:!aNULL:!MD5;          root \/var\/www\/aptly;          location \/ {                 autoindex on;         } }  # nginx prometheus exporter server {         listen 8080;          location \/stub_status {                 stub_status;                 allow 127.0.0.1;                 deny all;         } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS<\/h4>\n<p>\u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0440\u0430\u043d\u0435\u0435\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#issue\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e<\/a>\u00a0\u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">sudo cp ~\/repo.justnikobird.ru.crt \/opt\/nginx_exporter\/ sudo cp ~\/repo.justnikobird.ru.key \/opt\/nginx_exporter\/<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u00ab<em>\/opt\/nginx_exporter\/prometheus-nginx-exporter<\/em>\u00bb, \u043a\u0443\u0434\u0430 \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 https:<\/p>\n<pre><code class=\"bash\"># Set the command-line arguments to pass to the server. # Due to shell scaping, to pass backslashes for regexes, you need to double # them (\\\\d for \\d). If running under systemd, you need to double them again # (\\\\\\\\d to mean \\d), and escape newlines too. ARGS=\"-web.secured-metrics -web.ssl-server-cert \/opt\/nginx_exporter\/repo.justnikobird.ru.crt -web.ssl-server-key \/opt\/nginx_exporter\/repo.justnikobird.ru.key\"<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u00abnginx_exporter\u00bb \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo addgroup --system \"nginx_exporter\" --quiet sudo adduser --system --home \/usr\/share\/nginx_exporter --no-create-home --ingroup \"nginx_exporter\" --disabled-password --shell \/bin\/false \"nginx_exporter\"<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417 &#171;>\u0422\u0423\u0417<\/abbr> \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chown -R nginx_exporter:nginx_exporter \/opt\/nginx_exporter sudo chmod -R 755 \/opt\/nginx_exporter\/ sudo chmod 640 \/opt\/nginx_exporter\/*.crt sudo chmod 640 \/opt\/nginx_exporter\/*.key sudo chown nginx_exporter:nginx_exporter \/usr\/bin\/nginx-prometheus-exporter sudo chmod 755 \/usr\/bin\/nginx-prometheus-exporter<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h4>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/nginx_exporter.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Nginx Exporter:<\/p>\n<pre><code class=\"bash\">[Unit] Description=NGINX Prometheus Exporter Documentation=https:\/\/github.com\/nginxinc\/nginx-prometheus-exporter After=network.target nginx.service  [Service] Restart=on-failure User=nginx_exporter EnvironmentFile=\/opt\/nginx_exporter\/prometheus-nginx-exporter ExecStart=\/usr\/bin\/nginx-prometheus-exporter $ARGS  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Nginx Exporter \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart nginx_exporter.service sudo systemctl enable nginx_exporter.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9113<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h4>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u0438\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/781746\/#vm_info\" rel=\"noopener noreferrer nofollow\">\u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/a>\u00a0\u00ab10.0.0.6\u00bb:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp -s 10.0.0.6 --dport 9113 -j ACCEPT -m comment --comment prometheus_nginx_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0435\u043d\u0434\u0435.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0430 deb-\u043f\u0430\u043a\u0435\u0442\u0430 Nginx Exporter <\/h4>\n<p>\u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/783076\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 DEB-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438<\/strong><\/a>\u00bb.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u0447\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442\u0435:<\/p>\n<pre><code class=\"bash\">\/usr\/bin\/nginx-prometheus-exporter \/opt\/nginx_exporter\/prometheus-nginx-exporter \/etc\/systemd\/system\/nginx_exporter.service<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>install<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">nginx-prometheus-exporter usr\/bin\/ prometheus-nginx-exporter opt\/nginx_exporter\/ nginx_exporter.service etc\/systemd\/system\/<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>control<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">Source: nginx-exporter-lab Section: unknown Priority: optional Maintainer: Nikolay &lt;justnikobird@yandex.ru> Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.0 Homepage: &lt;insert the upstream URL, if relevant> #Vcs-Browser: https:\/\/salsa.debian.org\/debian\/just-nginx-exporter #Vcs-Git: https:\/\/salsa.debian.org\/debian\/just-nginx-exporter.git Rules-Requires-Root: no  Package: nginx-exporter-lab Architecture: all Depends: ${misc:Depends} Description: &lt;insert up to 60 chars description>  &lt;insert long description, indented with spaces><\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>postinst<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  set -e  USER=\"nginx_exporter\" GROUP=\"nginx_exporter\"  if ! getent group \"$GROUP\" > \/dev\/null 2>&amp;1 ; then   addgroup --system \"$GROUP\" --quiet fi  if ! id \"$USER\" > \/dev\/null 2>&amp;1 ; then   adduser --system --home \/usr\/share\/prometheus --no-create-home \\   --ingroup \"$GROUP\" --disabled-password --shell \/bin\/false \\   \"$USER\" fi  chown -R $USER:$GROUP \/opt\/nginx_exporter\/ chmod -R 755 \/opt\/nginx_exporter\/ chown $USER:$GROUP \/usr\/bin\/nginx-prometheus-exporter chmod 755 \/usr\/bin\/nginx-prometheus-exporter  echo -n \"Restarting nginx_exporter service...\"  if command -v systemctl >\/dev\/null; then   systemctl daemon-reload || true   systemctl enable nginx_exporter.service || true   systemctl restart nginx_exporter.service || true fi echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>prerm<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  echo 'Stopping and disabling nginx-exporter service...'  if command -v systemctl >\/dev\/null; then   systemctl stop nginx_exporter.service || true   systemctl disable nginx_exporter.service || true fi  userdel nginx_exporter >\/dev\/null 2>&amp;1 || true groupdel nginx_exporter >\/dev\/null 2>&amp;1 || true  echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u00a0\u00ab<strong>nginx-exporter-lab<em>_0.1-1_all.deb<\/em><\/strong>\u00bb.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#repo_upload\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c<\/a> \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<h3>Bash-\u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c bash-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:  <\/p>\n<details class=\"spoiler\">\n<summary>exporters.sh<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/github.com\/justnikobird\/young-devops-project\/blob\/main\/exporters.sh\" rel=\"noopener noreferrer nofollow\"><strong>\u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430 GitHub<\/strong><\/a><\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  # \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043e\u043f\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0435\u0441\u043b\u0438 \u043b\u044e\u0431\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c set -e  # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root if [[ \"${UID}\" -ne 0 ]]; then   echo -e \"You need to run this script as root!\"   exit 1 fi  # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 if [[ ! $(grep -rhE ^deb \/etc\/apt\/sources.list*) == *\"deb https:\/\/repo.justnikobird.ru:1111\/lab focal main\"* ]]; then   echo -e \"Lab repo not connected!\\nPlease run vm_start.sh script!\\n\"   exit 1 fi  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 command_check() {   if ! command -v \"$1\" &amp;>\/dev\/null; then     echo -e \"\\n====================\\n$2 could not be found!\\nInstalling...\\n====================\\n\"     apt-get install -y \"$3\"     echo -e \"\\nDONE\\n\"   fi }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 iptables \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e iptables_add() {   if ! iptables -C \"$@\" &amp;>\/dev\/null; then     iptables -A \"$@\"   fi }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f ip-\u0430\u0434\u0440\u0435\u0441\u0430 ip_request() {   while true; do     read -r -p $'\\n'\"Enter monitor vm ip (format 10.0.0.6): \" ip     if [[ $ip =~ ^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$ ]]; then       echo \"$ip\"       break     fi   done }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0438 \u0432 linux-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 path_request() {   while true; do     read -r -e -p $'\\n'\"Please input valid path to ${1}: \" path     if [ -f \"$path\" ]; then       echo \"$path\"       break     fi   done }  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e command_check systemctl restart systemd-timesyncd.service apt-get update command_check iptables \"Iptables\" iptables command_check netfilter-persistent \"Netfilter-persistent\" iptables-persistent command_check basename \"Basename\" coreutils command_check htpasswd \"Htpasswd\" apache2-utils  # \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0432 shell \u043c\u0435\u043d\u044e \u0441 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 while true; do   echo -e \"\\n--------------------------\\n\"   echo -e \"[1] node exporter\\n\"   echo -e \"[2] openvpn exporter\\n\"   echo -e \"[3] nginx exporter\\n\"   echo -e \"[4] exit\\n\"   echo -e \"--------------------------\\n\"   read -r -n 1 -p \"Select exporter for install: \" exporter    case $exporter in    # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c node-exporter   1)     echo -e \"\\n====================\\nNode Exporter Installing...\\n====================\\n\"      # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 node-exporter-lab     apt-get install -y node-exporter-lab      # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u0443\u0442\u0438 \u0434\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u043a\u043b\u044e\u0447\u0430     cert_path=$(path_request certificate)     key_path=$(path_request key)      # \u043e\u0442\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0442 \u043f\u0443\u0442\u0435\u0439     cert_file=$(basename \"$cert_path\")     key_file=$(basename \"$key_path\")      # \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0444\u0430\u0439\u043b\u044b \u043a\u043b\u044e\u0447\u0430 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435     cp \"$cert_path\" \/opt\/node_exporter\/     cp \"$key_path\" \/opt\/node_exporter\/     chmod 640 \/opt\/node_exporter\/\"$cert_file\"     chmod 640 \/opt\/node_exporter\/\"$key_file\"     chown node_exporter:node_exporter \/opt\/node_exporter\/\"$cert_file\"     chown node_exporter:node_exporter \/opt\/node_exporter\/\"$key_file\"      # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b     read -r -p $'\\n'\"Node Exporter username: \" username     read -r -p $'\\n'\"Node Exporter password: \" -s password     echo -e \"tls_server_config:\\n  cert_file: $cert_file\\n  key_file: $key_file\\n\\nbasic_auth_users:\\n  $username: '$(htpasswd -nbB -C 10 admin \"$password\" | grep -o \"\\$.*\")'\" >\/opt\/node_exporter\/web.yml      # \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c iptables     echo -e \"\\n====================\\nIptables configuration\\n====================\\n\"     monitor_vm_ip=$(ip_request)     iptables_add INPUT -p tcp -s \"$monitor_vm_ip\" --dport 9100 -j ACCEPT -m comment --comment prometheus_node_exporter     echo -e \"\\n====================\\nSaving iptables config\\n====================\\n\"     service netfilter-persistent save     echo -e \"\\nDONE\\n\"      # \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c node-exporter-\u0441\u0435\u0440\u0432\u0438\u0441     systemctl daemon-reload     systemctl restart node_exporter.service     systemctl enable node_exporter.service      echo -e \"\\n====================\\nNode Exporter listening on port 9100\\n====================\\n\"     echo -e \"\\nOK\\n\"     ;;    2)     echo -e \"\\n====================\\nOpenvpn Exporter Installing...\\n====================\\n\"      # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 openvpn-exporter-lab     apt-get install -y openvpn-exporter-lab      # \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c iptables     echo -e \"\\n====================\\nIptables configuration\\n====================\\n\"     monitor_vm_ip=$(ip_request)     iptables_add INPUT -p tcp -s \"$monitor_vm_ip\" --dport 9176 -j ACCEPT -m comment --comment prometheus_openvpn_exporter     echo -e \"\\n====================\\nSaving iptables config\\n====================\\n\"     service netfilter-persistent save     echo -e \"\\nDONE\\n\"      # \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c openvpn-exporter-\u0441\u0435\u0440\u0432\u0438\u0441     systemctl daemon-reload     systemctl restart openvpn_exporter.service     systemctl enable openvpn_exporter.service      echo -e \"\\n====================\\nOpenvpn Exporter listening on port 9176\\n====================\\n\"     echo -e \"\\nOK\\n\"     ;;    3)     echo -e \"\\n====================\\nConfigure Nginx \/stub_status location on 8080 port before install \\n====================\\n\"     echo -e \"\\n====================\\nNginx Exporter Installing...\\n====================\\n\"      # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 nginx-exporter-lab     apt-get install -y nginx-exporter-lab      # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u0443\u0442\u0438 \u0434\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u043a\u043b\u044e\u0447\u0430     cert_path=$(path_request certificate)     key_path=$(path_request key)      # \u043e\u0442\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0442 \u043f\u0443\u0442\u0435\u0439     cert_file=$(basename \"$cert_path\")     key_file=$(basename \"$key_path\")      # \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c \u0444\u0430\u0439\u043b\u044b \u043a\u043b\u044e\u0447\u0430 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435     cp \"$cert_path\" \/opt\/nginx_exporter\/     cp \"$key_path\" \/opt\/nginx_exporter\/     new_cert_path=\"\/opt\/nginx_exporter\/$cert_file\"     new_key_path=\"\/opt\/nginx_exporter\/$key_file\"     chmod 640 \"$new_cert_path\"     chmod 640 \"$new_key_path\"     chown nginx_exporter:nginx_exporter \"$new_cert_path\"     chown nginx_exporter:nginx_exporter \"$new_key_path\"      # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0435 \u0438 \u043a\u043b\u044e\u0447\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b     echo 'ARGS=\"-web.secured-metrics -web.ssl-server-cert '\"$new_cert_path\"' -web.ssl-server-key '\"$new_key_path\"'' >\/opt\/nginx_exporter\/prometheus-nginx-exporter      # \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c iptables     echo -e \"\\n====================\\nIptables configuration\\n====================\\n\"     monitor_vm_ip=$(ip_request)     iptables_add INPUT -p tcp -s \"$monitor_vm_ip\" --dport 9113 -j ACCEPT -m comment --comment prometheus_nginx_exporter     echo -e \"\\n====================\\nSaving iptables config\\n====================\\n\"     service netfilter-persistent save     echo -e \"\\nDONE\\n\"      # \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c nginx-exporter-\u0441\u0435\u0440\u0432\u0438\u0441     systemctl daemon-reload     systemctl restart nginx_exporter.service     systemctl enable nginx_exporter.service      echo -e \"\\n====================\\nNginx Exporter listening on port 9113\\n====================\\n\"     echo -e \"\\nOK\\n\"     ;;    4)     echo -e \"\\n\\nOK\\n\"     exit 0     ;;    *)     echo -e \"\\n\\nUnknown\\n\"     ;;   esac done<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<hr\/>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u043a Prometheus<\/h2>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0445 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u043d\u0430 vm \u00abmonitor\u00bb \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u00ab<em>\/etc\/prometheus<\/em>\u00bb:<\/p>\n<pre><code class=\"bash\">sudo cp ~\/ca.justnikobird.ru.crt \/etc\/prometheus\/ sudo cp ~\/vpn.justnikobird.ru.crt \/etc\/prometheus\/ sudo cp ~\/repo.justnikobird.ru.crt \/etc\/prometheus\/ sudo chmod 640 \/etc\/prometheus\/*.crt sudo chown prometheus:prometheus \/etc\/prometheus\/*.crt<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u043f\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0430\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 DNS \u0432 \u0444\u0430\u043b\u0435 \u00ab<em>\/etc\/hosts<\/em>\u00bb:<\/p>\n<pre><code class=\"bash\">127.0.0.1 monitor.justnikobird.ru 10.0.0.4 ca.justnikobird.ru 10.0.0.5 vpn.justnikobird.ru 10.0.0.7 repo.justnikobird.ru<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Prometheus \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u00ab<em>\/etc\/prometheus\/prometheus.yml<\/em>\u00bb \u0432 \u0431\u043b\u043e\u043a\u0435 \u00abscrape_configs\u00bb:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 Prometheus \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">scrape_configs:   - job_name: 'prometheus-monitor'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['monitor.justnikobird.ru:9090']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Node Exporters<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">  - job_name: 'node-monitor'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['monitor.justnikobird.ru:9100']    - job_name: 'node-ca'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: ca.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['ca.justnikobird.ru:9100']    - job_name: 'node-openvpn'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: vpn.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['vpn.justnikobird.ru:9100']    - job_name: 'node-repo'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: repo.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['repo.justnikobird.ru:9100']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 OpenVPN Exporter<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">  - job_name: 'openvpn'     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['vpn.justnikobird.ru:9176']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Nginx Exporter<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">  - job_name: 'nginx-repo'     scheme: https     tls_config:       ca_file: repo.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['repo.justnikobird.ru:9113']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Prometheus \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">global:   scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.   evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.   # scrape_timeout is set to the global default (10s).  # Alertmanager configuration ...  # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. ...  # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs:   # The job name is added as a label `job=&lt;job_name>` to any timeseries scraped from this config.   - job_name: 'prometheus-monitor'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['monitor.justnikobird.ru:9090']    - job_name: 'node-monitor'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['monitor.justnikobird.ru:9100']    - job_name: 'node-ca'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: ca.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['ca.justnikobird.ru:9100']    - job_name: 'node-vpn'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: vpn.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['vpn.justnikobird.ru:9100']    - job_name: 'node-repo'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: repo.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['repo.justnikobird.ru:9100']    - job_name: 'openvpn'     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['vpn.justnikobird.ru:9176']    - job_name: 'nginx-repo'     scheme: https     tls_config:       ca_file: repo.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['repo.justnikobird.ru:9113']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Prometheus \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u00abpromtool\u00bb:<\/p>\n<pre><code class=\"bash\">sudo promtool check config \/etc\/prometheus\/prometheus.yml<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo iptables -A OUTPUT -p tcp -d 10.0.0.0\/24 --dport 9100 -j ACCEPT -m comment --comment Prometheus_node_exporter sudo iptables -A OUTPUT -p tcp -d 10.0.0.0\/24 --dport 9176 -j ACCEPT -m comment --comment prometheus_openvpn_exporter sudo iptables -A OUTPUT -p tcp -d 10.0.0.0\/24 --dport 9113 -j ACCEPT -m comment --comment prometheus_nginx_exporter<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c Prometheus:  <\/p>\n<pre><code class=\"bash\">sudo systemctl restart prometheus.service<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 <abbr class=\"habraabbr\" title=\"https:\/\/monitor.justnikobird.ru:9090\" data-title=\"&lt;p>&lt;a href=&quot;https:\/\/monitor.justnikobird.ru:9090\/graph?g0.expr=&amp;amp;g0.tab=1&amp;amp;g0.stacked=0&amp;amp;g0.show_exemplars=0&amp;amp;g0.range_input=1h&quot;>&lt;strong>https:\/\/monitor.justnikobird.ru:9090&lt;\/strong>&lt;\/a>&lt;\/p>&#187; data-abbr=&#187;web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435&#187;>web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435<\/abbr> &#8212; \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u00abStatus\u00bb \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u043d\u043a\u0442 \u00abTargets\u00bb: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/265\/9cb\/484\/2659cb484ec2d2816d5377dfdaf7b0ae.png\" width=\"1125\" height=\"798\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/265\/9cb\/484\/2659cb484ec2d2816d5377dfdaf7b0ae.png\"\/><\/figure>\n<hr\/>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Prometheus AlertManager<\/h2>\n<p>AlertManager \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0430\u043b\u0435\u0440\u0442\u044b \u043e\u0442 Prometheus, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0445, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u0442 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430\u0445. AlertManager \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0438\u0431\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439\u00a0\u0438 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u0442\u044c \u0438\u0445 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u043a\u0430\u043d\u0430\u043b\u0430\u043c: \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b, \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f Telegram.<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb \u0438 \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b AlertManager \u0432\u0435\u0440\u0441\u0438\u0438 0.26.0 c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/prometheus\/alertmanager\/releases\/download\/v0.26.0\/alertmanager-0.26.0.linux-amd64.tar.gz tar xvf ~\/alertmanager-0.26.0.linux-amd64.tar.gz &amp;&amp; cd ~\/alertmanager-0.26.0.linux-amd64 sudo cp amtool \/usr\/bin\/ sudo cp alertmanager \/usr\/bin\/ sudo ln -s \/usr\/bin\/amtool \/usr\/local\/bin\/amtool sudo ln -s \/usr\/bin\/alertmanager \/usr\/local\/bin\/alertmanager sudo cp alertmanager.yml \/etc\/prometheus\/<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0444\u0430\u0439\u043b\u0430\u0445<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>amtool:<\/strong> \u0418\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 AlertManager. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, amtool \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0438\u0445. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 AlertManager \u0431\u0435\u0437 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>alertmanager:<\/strong> \u0418\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Alert Manager.<\/p>\n<p><strong>alertmanager.yml:<\/strong> \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b AlertManager.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 AlertManager:<\/p>\n<pre><code class=\"bash\">sudo mkdir \/etc\/prometheus\/alertmanager_data<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo touch \/etc\/prometheus\/rules.yml<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c Prometheus \u043a AlertManager \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u00ab<em>\/etc\/prometheus\/prometheus.yml<\/em>\u00bb \u0432 \u0431\u043b\u043e\u043a\u0435 \u00abalerting\u00bb:<\/p>\n<pre><code class=\"bash\">alerting:   alertmanagers:   - scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     static_configs:     - targets: ['monitor.justnikobird.ru:9093']<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Prometheus \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u00abpromtool\u00bb:<\/p>\n<pre><code class=\"bash\">sudo promtool check config \/etc\/prometheus\/prometheus.yml<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439<\/h3>\n<p>AlertManager \u0438 Prometheus \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 https, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code class=\"bash\">\/etc\/prometheus\/web.yml<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417&#187;>\u0422\u0423\u0417<\/abbr> \u00abprometheus\u00bb \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chown -R prometheus:prometheus \/etc\/prometheus\/alertmanager_data sudo chmod -R 755 \/etc\/prometheus\/alertmanager_data sudo chown prometheus:prometheus \/usr\/bin\/amtool sudo chown -h prometheus:prometheus \/usr\/local\/bin\/amtool sudo chmod 755 \/usr\/bin\/amtool sudo chown prometheus:prometheus \/usr\/bin\/alertmanager sudo chown -h prometheus:prometheus \/usr\/local\/bin\/alertmanager sudo chmod 755 \/usr\/bin\/alertmanager sudo chown prometheus:prometheus \/etc\/prometheus\/alertmanager.yml  sudo chmod 755 \/etc\/prometheus\/alertmanager.yml sudo chown prometheus:prometheus \/etc\/prometheus\/rules.yml sudo chmod 755 \/etc\/prometheus\/rules.yml<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u0435\u0439 \u0430\u043b\u0435\u0440\u0442\u043e\u0432:<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441 \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 &#8212;  \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e email \u0438 telegram. <\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043f\u043e Email<\/h4>\n<p>\u0414\u043b\u044f \u043f\u043e\u0447\u0442\u044b \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 smtp-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 yandex) \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u0432 \u0441\u0432\u043e\u0439 <a href=\"https:\/\/id.yandex.ru\/\" rel=\"noopener noreferrer nofollow\">yandex-\u0430\u043a\u043a\u0430\u0443\u043d\u0442<\/a>, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00abSecurity\u00bb <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e61\/90f\/488\/e6190f488ee2f4ad103b2d17151ed4bc.png\" width=\"222\" height=\"437\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e61\/90f\/488\/e6190f488ee2f4ad103b2d17151ed4bc.png\"\/><\/figure>\n<p>\u0412 \u0431\u043b\u043e\u043a\u0435 \u00abAccess to your data\u00bb \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u043d\u043a\u0442 \u00abApp passwords\u00bb: <\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6eb\/8c6\/889\/6eb8c6889696643527ff23320b198e20.png\" width=\"561\" height=\"296\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6eb\/8c6\/889\/6eb8c6889696643527ff23320b198e20.png\"\/><\/figure>\n<p>\u0412 \u0431\u043b\u043e\u043a\u0435 \u00abCreate an app password\u00bb \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u043d\u043a\u0442 \u00abEmail address\u00bb: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/afa\/1c2\/ec8\/afa1c2ec8cc01e200124ff2e8887f171.png\" width=\"581\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/afa\/1c2\/ec8\/afa1c2ec8cc01e200124ff2e8887f171.png\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043d\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Yandex. <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0441\u0435\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u00ab<em>\/etc\/prometheus\/alertmanager.yml<\/em>\u00bb\u00a0\u0432 \u0431\u043b\u043e\u043a \u00abreceivers\u00bb:<\/p>\n<pre><code class=\"bash\">receivers: - name: 'nikolay'   email_configs:   - to: 'justnikobird@yandex.ru'     from: 'justnikobird@yandex.ru'     smarthost: 'smtp.yandex.ru:587'     auth_username: 'justnikobird'     auth_identity: 'justnikobird'     auth_password: '***' <\/code><\/pre>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u0432 Telegram<\/h4>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439 \u0432 Telegram \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043a\u0435\u043d:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7e9\/fb6\/ee0\/7e9fb6ee0d32d382e9c4ec37f21980d6.png\" width=\"495\" height=\"579\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7e9\/fb6\/ee0\/7e9fb6ee0d32d382e9c4ec37f21980d6.png\"\/><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u0432\u043e\u0439 chat-id:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/937\/912\/c6b\/937912c6b1c616d0f82654b3da03f258.png\" width=\"300\" height=\"169\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/937\/912\/c6b\/937912c6b1c616d0f82654b3da03f258.png\"\/><\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0441\u0435\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u00ab<em>\/etc\/prometheus\/alertmanager.yml<\/em>\u00bb \u0432 \u0431\u043b\u043e\u043a \u00abreceivers\u00bb:<\/p>\n<pre><code class=\"bash\">  telegram_configs:   - bot_token: '6941051793:AAFcw9nzSuzs718vgMSa9JR02gNOy3aYSyQ'     chat_id: ***<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Alertmanager \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">route:   group_by: ['alertname']   group_wait: 30s   group_interval: 5m   repeat_interval: 1h   receiver: 'nikolay'  receivers: - name: 'nikolay'    email_configs:   - to: 'justnikobird@yandex.ru'     from: 'justnikobird@yandex.ru'     smarthost: 'smtp.yandex.ru:587'     auth_username: 'justnikobird'     auth_identity: 'justnikobird'     auth_password: '***'    telegram_configs:   - bot_token: '6622906782:AAENZl4MCCp0DtzK6XIVqA9q0kp0BtaYC5I'     chat_id: ***  inhibit_rules:   - source_match:       severity: 'critical'     target_match:       severity: 'warning'     equal: ['alertname', 'dev', 'instance']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h3>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb\u00a0c\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/prometheus-alertmanager.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 AlertManager:<\/p>\n<pre><code class=\"bash\">[Unit] Description=Alertmanager Service After=network.target [Service] EnvironmentFile=-\/etc\/default\/alertmanager User=prometheus Group=prometheus Type=simple ExecStart=\/usr\/bin\/alertmanager $ARGS --config.file=\/etc\/prometheus\/alertmanager.yml --web.config.file=\/etc\/prometheus\/web.yml --storage.path=\/etc\/prometheus\/alertmanager_data ExecReload=\/bin\/kill -HUP $MAINPID Restart=on-failure [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c AlertManager \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart prometheus-alertmanager.service sudo systemctl enable prometheus-alertmanager.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9093.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp --dport 9093 -j ACCEPT -m comment --comment prometheus_alertmanager sudo iptables -A OUTPUT -p tcp --dport 587 -j ACCEPT -m comment --comment smtp<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u00ab<a href=\"https:\/\/monitor.justnikobird.ru:9093\/\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/monitor.justnikobird.ru:9093<\/strong><\/a>\u00bb<strong> <\/strong>\u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e AlertManager \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043e\u0432<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u00ab<em>\/etc\/prometheus\/prometheus.yml<\/em>\u00bb, \u0432 \u0431\u043b\u043e\u043a\u0435 \u00abrule_files\u00bb \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0444\u0430\u0439\u043b \u00ab<em>rules.yml<\/em>\u00bb, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043e\u0432:<\/p>\n<pre><code class=\"bash\">rule_files:   - rules.yml<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Prometheus \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">global:   scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.   evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.   # scrape_timeout is set to the global default (10s).  # Alertmanager configuration alerting:   alertmanagers:   - scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     static_configs:     - targets: ['monitor.justnikobird.ru:9093']  # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files:   - rules.yml  # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs:   # The job name is added as a label `job=&lt;job_name>` to any timeseries scraped from this config.   - job_name: 'prometheus-monitor'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['monitor.justnikobird.ru:9090']    - job_name: 'node-monitor'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: monitor.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['monitor.justnikobird.ru:9100']    - job_name: 'node-ca'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: ca.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['ca.justnikobird.ru:9100']    - job_name: 'node-vpn'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: vpn.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['vpn.justnikobird.ru:9100']    - job_name: 'node-repo'     scheme: https     basic_auth:       username: admin       password: password     tls_config:       ca_file: repo.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['repo.justnikobird.ru:9100']    - job_name: 'openvpn'     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['vpn.justnikobird.ru:9176']    - job_name: 'nginx-repo'     scheme: https     tls_config:       ca_file: repo.justnikobird.ru.crt     scrape_interval: 5s     scrape_timeout: 5s     static_configs:       - targets: ['repo.justnikobird.ru:9113']<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c PromQL-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043b\u0435\u0440\u0442\u043e\u0432:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"center\"><strong>PromQL-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0435\u0440\u0442\u0430<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" data-colwidth=\"573,0\" width=\"573\">\n<p align=\"center\"><strong>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 Linux \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 vm \u00abca\u00bb<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">((node_filesystem_avail_bytes{job=&#187;node-ca&#187;, mountpoint=&#187;\/&#187;,fstype!=&#187;rootfs&#187;} \/ node_filesystem_size_bytes{job=&#187;node-ca&#187;, mountpoint=&#187;\/&#187;,fstype!=&#187;rootfs&#187;}) * 100) &lt; 10<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 &lt; 10%<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">((node_memory_MemAvailable_bytes{job=&#187;node-ca&#187;} \/ node_memory_MemTotal_bytes{job=&#187;node-ca&#187;}) * 100) &lt; 10<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 &lt; 10%<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">node_load1{job=&#187;node-ca&#187;} > 0.9<\/p>\n<\/td>\n<td>\n<p align=\"left\">loadaverage \u0437\u0430 \u043c\u0438\u043d\u0443\u0442\u0443 > 0.9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">(rate(node_network_receive_bytes_total{job=&#187;node-ca&#187;, device=&#187;eth0&#8243;}[5m]) \/ 1024 \/ 1024) > 150<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u043f\u043e\u0440\u0442 > 150 Mb\/s<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">(rate(node_network_transmit_bytes_total{job=&#187;node-ca&#187;, device=&#187;eth0&#8243;}[5m]) \/ 1024 \/ 1024) > 150<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u043f\u043e\u0440\u0442 > 150 Mb\/s<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" data-colwidth=\"573,0\" width=\"573\">\n<p align=\"center\"><strong>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 OpenVPN<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">openvpn_up == 0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 down<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">openvpn_server_connected_clients == 0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 == 0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" data-colwidth=\"573,0\" width=\"573\">\n<p align=\"center\"><strong>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 Nginx<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">nginx_up == 0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 down<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"573\" width=\"573\">\n<p align=\"left\">nginx_connections_active == 0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439 == 0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0432 \u0444\u0430\u0439\u043b\u0435 \u00ab<em>\/etc\/prometheus\/rules.yml<\/em>\u00bb:<\/p>\n<details class=\"spoiler\">\n<summary>rules.yml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">groups: - name: ca   rules:   - alert: CA_node_exporter_down     expr: up{job=\"node-ca\"} == 0     for: 10s     annotations:       title: 'CA Node Exporter Down'       description: 'CA Node Exporter Down'     labels:       severity: 'crit'    - alert: CA_High_CPU_utiluzation     expr: node_load1{job=\"node-ca\"} > 0.9     for: 1m     annotations:       title: 'High CPU utiluzation'       description: 'High CPU utiluzation'     labels:       severity: 'crit'    - alert: CA_High_memory_utiluzation     expr: ((node_memory_MemAvailable_bytes{job=\"node-ca\"} \/ node_memory_MemTotal_bytes{job=\"node-ca\"}) * 100) &lt; 10     for: 1m     annotations:       title: 'High memory utiluzation'       description: 'High memory utiluzation'     labels:       severity: 'crit'    - alert: CA_Disc_space_problem     expr: ((node_filesystem_avail_bytes{job=\"node-ca\", mountpoint=\"\/\",fstype!=\"rootfs\"} \/ node_filesystem_size_bytes{job=\"node-ca\", mountpoint=\"\/\",fstype!=\"rootfs\"}) * 100) &lt; 10     for: 10m     annotations:       title: 'Disk 90% full'       description: 'Disk 90% full'     labels:       severity: 'crit'    - alert: CA_High_port_incoming_utilization     expr: (rate(node_network_receive_bytes_total{job=\"node-ca\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: 'High port input load'       description: 'Incoming port load > 150 Mb\/s'     labels:       severity: 'crit'    - alert: CA_High_port_outcoming_utilization     expr: (rate(node_network_transmit_bytes_total{ job=\"node-ca\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: High outbound port utilization       description: 'Outcoming port load > 150 Mb\/s'     labels:       severity: 'crit'  - name: vpn   rules:   - alert: Vpn_node_exporter_down     expr: up{job=\"node-vpn\"} == 0     for: 10s     annotations:       title: 'Vpn Node Exporter Down'       description: 'Vpn Node Exporter Down'     labels:       severity: 'crit'    - alert: Vpn_exporter_down     expr: up{job=\"openvpn\"} == 0     for: 10s     annotations:       title: 'Vpn Exporter Down'       description: 'Vpn Exporter Down'     labels:       severity: 'crit'    - alert: VpnDown     expr: openvpn_up == 0     for: 10s     annotations:       title: 'VPN Service down'       description: 'VPN Service down'     labels:       severity: 'crit'    - alert: Vpn_NoClientConnected     expr: openvpn_server_connected_clients == 0     for: 10s     annotations:       title: 'No Client Connected'       description: 'No Client Connected'     labels:       severity: 'crit'    - alert: Vpn_High_CPU_utiluzation     expr: node_load1{job=\"node-vpn\"} > 0.9     for: 1m     annotations:       title: 'High CPU utiluzation'       description: 'High CPU utiluzation'     labels:       severity: 'crit'    - alert: Vpn_High_memory_utiluzation     expr: ((node_memory_MemAvailable_bytes{job=\"node-vpn\"} \/ node_memory_MemTotal_bytes{job=\"node-vpn\"}) * 100) &lt; 10     for: 1m     annotations:       title: 'High memory utiluzation'       description: 'High memory utiluzation'     labels:       severity: 'crit'    - alert: Vpn_Disc_space_problem     expr: ((node_filesystem_avail_bytes{job=\"node-vpn\", mountpoint=\"\/\",fstype!=\"rootfs\"} \/ node_filesystem_size_bytes{job=\"node-vpn\", mountpoint=\"\/\",fstype!=\"rootfs\"}) * 100) &lt; 10     for: 10m     annotations:       title: 'Disk 90% full'       description: 'Disk 90% full'     labels:       severity: 'crit'    - alert: Vpn_High_port_incoming_utilization     expr: (rate(node_network_receive_bytes_total{job=\"node-vpn\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: 'High port input load'       description: 'Incoming port load > 150 Mb\/s'     labels:       severity: 'crit'    - alert: Vpn_High_port_outcoming_utilization     expr: (rate(node_network_transmit_bytes_total{ job=\"node-vpn\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: High outbound port utilization       description: 'Outcoming port load > 150 Mb\/s'     labels:       severity: 'crit'  - name: monitor   rules:   - alert: Monitor_node_exporter_down     expr: up{job=\"node-monitor\"} == 0     for: 10s     annotations:       title: 'Monitor Node Exporter Down'       description: 'Monitor Node Exporter Down'     labels:       severity: 'crit'    - alert: Monitor_prometheus_exporter_down     expr: up{job=\"prometheus-monitor\"} == 0     for: 10s     annotations:       title: 'Monitor Node Exporter Down'       description: 'Monitor Node Exporter Down'     labels:       severity: 'crit'    - alert: Monitor_High_CPU_utiluzation     expr: node_load1{job=\"node-monitor\"} > 0.9     for: 1m     annotations:       title: 'High CPU utiluzation'       description: 'High CPU utiluzation'     labels:       severity: 'crit'    - alert: Monitor_High_memory_utiluzation     expr: ((node_memory_MemAvailable_bytes{job=\"node-monitor\"} \/ node_memory_MemTotal_bytes{job=\"node-monitor\"}) * 100) &lt; 10     for: 1m     annotations:       title: 'High memory utiluzation'       description: 'High memory utiluzation'     labels:       severity: 'crit'    - alert: Monitor_Disc_space_problem     expr: ((node_filesystem_avail_bytes{job=\"node-monitor\", mountpoint=\"\/\",fstype!=\"rootfs\"} \/ node_filesystem_size_bytes{job=\"node-monitor\", mountpoint=\"\/\",fstype!=\"rootfs\"}) * 100) &lt; 10     for: 10m     annotations:       title: 'Disk 90% full'       description: 'Disk 90% full'     labels:       severity: 'crit'    - alert: Monitor_High_port_incoming_utilization     expr: (rate(node_network_receive_bytes_total{job=\"node-monitor\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: 'High port input load'       description: 'Incoming port load > 150 Mb\/s'     labels:       severity: 'crit'    - alert: Monitor_High_port_outcoming_utilization     expr: (rate(node_network_transmit_bytes_total{ job=\"node-monitor\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: High outbound port utilization       description: 'Outcoming port load > 150 Mb\/s'     labels:       severity: 'crit'  - name: repo   rules:   - alert: Repo_node_exporter_down     expr: up{job=\"node-repo\"} == 0     for: 10s     annotations:       title: 'Repo Node Exporter Down'       description: 'Repo Node Exporter Down'     labels:       severity: 'crit'    - alert: Repo_nginx_exporter_down     expr: up{job=\"nginx-repo\"} == 0     for: 10s     annotations:       title: 'Repo Nginx Exporter Down'       description: 'Repo Nginx Exporter Down'     labels:       severity: 'crit'    - alert: Repo_NginxDown     expr: nginx_up == 0     for: 10s     annotations:       title: 'Nginx Service down'       description: 'Nginx Service down'     labels:       severity: 'crit'    - alert: Repo_NoActiveClientConnections     expr: nginx_connections_active == 1     for: 10s     annotations:       title: 'No active connections'       description: 'No active connections except nginx exporter'     labels:       severity: 'crit'    - alert: Repo_NoActiveConnections     expr: nginx_connections_active == 0     for: 10s     annotations:       title: 'No active connections'       description: 'No active connections'     labels:       severity: 'crit'    - alert: Repo_High_CPU_utiluzation     expr: node_load1{job=\"node-repo\"} > 0.9     for: 1m     annotations:       title: 'High CPU utiluzation'       description: 'High CPU utiluzation'     labels:       severity: 'crit'    - alert: Repo_High_memory_utiluzation     expr: ((node_memory_MemAvailable_bytes{job=\"node-repo\"} \/ node_memory_MemTotal_bytes{job=\"node-repo\"}) * 100) &lt; 10     for: 1m     annotations:       title: 'High memory utiluzation'       description: 'High memory utiluzation'     labels:       severity: 'crit'    - alert: Repo_Disc_space_problem     expr: ((node_filesystem_avail_bytes{job=\"node-repo\", mountpoint=\"\/\",fstype!=\"rootfs\"} \/ node_filesystem_size_bytes{job=\"node-repo\", mountpoint=\"\/\",fstype!=\"rootfs\"}) * 100) &lt; 10     for: 10m     annotations:       title: 'Disk 90% full'       description: 'Disk 90% full'     labels:       severity: 'crit'    - alert: Repo_High_port_incoming_utilization     expr: (rate(node_network_receive_bytes_total{job=\"node-repo\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: 'High port input load'       description: 'Incoming port load > 150 Mb\/s'     labels:       severity: 'crit'    - alert: Repo_High_port_outcoming_utilization     expr: (rate(node_network_transmit_bytes_total{ job=\"node-repo\", device=\"eth0\"}[5m]) \/ 1024 \/ 1024) > 150     for: 5s     annotations:       title: High outbound port utilization       description: 'Outcoming port load > 150 Mb\/s'     labels:       severity: 'crit'<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0440\u0430\u0432\u0438\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u00abpromtool\u00bb:<\/p>\n<pre><code class=\"bash\">sudo promtool check rules \/etc\/prometheus\/rules.yml<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c AlertManager \u0438 Prometheus:<\/p>\n<pre><code class=\"bash\">sudo systemctl restart prometheus-alertmanager.service sudo systemctl restart prometheus.service<\/code><\/pre>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432 web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Prometheus \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00abAlerts\u00bb \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dbe\/ee3\/ac7\/dbeee3ac748f844dd5a946a95ca36b99.png\" width=\"1244\" height=\"874\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dbe\/ee3\/ac7\/dbeee3ac748f844dd5a946a95ca36b99.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7ac\/54c\/c2c\/7ac54cc2cfa813586941a07a2b32254d.png\" width=\"1248\" height=\"1052\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ac\/54c\/c2c\/7ac54cc2cfa813586941a07a2b32254d.png\"\/><\/figure>\n<p>\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0442 AlertManager \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/80e\/e02\/dab\/80ee02dab604778680d81e89d7ccf931.png\" alt=\"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0432 Telegram\" title=\"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0432 Telegram\" width=\"440\" height=\"471\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/80e\/e02\/dab\/80ee02dab604778680d81e89d7ccf931.png\"\/><\/p>\n<div><figcaption>\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0432 Telegram<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/284\/7cb\/de5\/2847cbde5decd3d8065a9700687509b6.png\" alt=\"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u043e Email\" title=\"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u043e Email\" width=\"563\" height=\"697\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/284\/7cb\/de5\/2847cbde5decd3d8065a9700687509b6.png\"\/><\/p>\n<div><figcaption>\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u043e Email<\/figcaption><\/div>\n<\/figure>\n<h3>\u0421\u0431\u043e\u0440\u043a\u0430 deb-\u043f\u0430\u043a\u0435\u0442\u0430 Prometheus \u0441 AlertManager<\/h3>\n<p>\u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/783076\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 DEB-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438<\/strong><\/a>\u00bb.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u0447\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442\u0435:<\/p>\n<pre><code class=\"bash\">\/etc\/prometheus\/alertmanager.yml \/etc\/prometheus\/console_libraries\/ \/etc\/prometheus\/consoles\/ \/etc\/prometheus\/prometheus.yml \/etc\/prometheus\/rules.yml \/etc\/prometheus\/web.yml \/usr\/bin\/prometheus \/usr\/bin\/promtool  \/usr\/bin\/alertmanager \/usr\/bin\/amtool \/etc\/systemd\/system\/prometheus.service \/etc\/systemd\/system\/prometheus-alertmanager.service<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>install<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">alertmanager.yml etc\/prometheus console_libraries\/ etc\/prometheusi consoles\/ etc\/prometheus prometheus.yml etc\/prometheus rules.yml etc\/prometheus web.yml etc\/prometheus prometheus usr\/bin promtool usr\/bin alertmanager usr\/bin amtool usr\/bin prometheus.service etc\/systemd\/system prometheus-alertmanager.service etc\/systemd\/system<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>control<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">Source: prometheus-lab Section: unknown Priority: optional Maintainer: Nikolay &lt;justnikobird@yandex.ru> Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.0 Homepage: &lt;insert the upstream URL, if relevant> #Vcs-Browser: https:\/\/salsa.debian.org\/debian\/just-prometheus #Vcs-Git: https:\/\/salsa.debian.org\/debian\/just-prometheus.git Rules-Requires-Root: no  Package: prometheus-lab Architecture: all Depends: ${misc:Depends} Description: &lt;insert up to 60 chars description>  &lt;insert long description, indented with spaces><\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>postinst<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  set -e  USER=\"prometheus\" GROUP=\"prometheus\"  if ! getent group \"$GROUP\" > \/dev\/null 2>&amp;1 ; then   addgroup --system \"$GROUP\" --quiet fi  if ! id \"$USER\" > \/dev\/null 2>&amp;1 ; then   adduser --system --home \/usr\/share\/prometheus --no-create-home \\   --ingroup \"$GROUP\" --disabled-password --shell \/bin\/false \\   \"$USER\" fi  if [ ! -d \"\/var\/lib\/prometheus\/\" ]; then   mkdir \/var\/lib\/prometheus\/   chown -R $USER:$GROUP \/var\/lib\/prometheus\/   chmod -R 755 \/var\/lib\/prometheus\/ fi  if [ ! -d \"\/etc\/prometheus\/alertmanager_data\/\" ]; then   mkdir \/etc\/prometheus\/alertmanager_data\/   chown -R $USER:$GROUP \/etc\/prometheus\/alertmanager_data\/   chmod -R 755 \/etc\/prometheus\/alertmanager_data\/ fi  chown -R $USER:$GROUP \/etc\/prometheus\/ chmod -R 755 \/etc\/prometheus\/ chown $USER:$GROUP \/usr\/bin\/prometheus chmod 755 \/usr\/bin\/prometheus chown $USER:$GROUP \/usr\/bin\/promtool chmod 755 \/usr\/bin\/promtool chown $USER:$GROUP \/usr\/bin\/alertmanager chmod 755 \/usr\/bin\/alertmanager chown $USER:$GROUP \/usr\/bin\/amtool chmod 755 \/usr\/bin\/amtool  ln -s \/usr\/bin\/prometheus \/usr\/local\/bin\/prometheus chown -h prometheus:prometheus \/usr\/local\/bin\/prometheus  ln -s \/usr\/bin\/promtool \/usr\/local\/bin\/promtool chown -h prometheus:prometheus \/usr\/local\/bin\/promtool  ln -s \/usr\/bin\/alertmanager \/usr\/local\/bin\/alertmanager chown -h prometheus:prometheus \/usr\/local\/bin\/alertmanager  ln -s \/usr\/bin\/amtool \/usr\/local\/bin\/amtool chown -h prometheus:prometheus \/usr\/local\/bin\/amtool  echo -n \"Restarting prometheus-server service...\"  if command -v systemctl >\/dev\/null; then   systemctl daemon-reload   systemctl restart prometheus.service || true   systemctl restart prometheus-alertmanager.service || true fi  echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>prerm<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh  echo 'Stopping and disabling prometheus-server service...'  if command -v systemctl >\/dev\/null; then   systemctl stop prometheus.service || true   systemctl disable prometheus.service || true   systemctl stop prometheus-alertmanager.service || true   systemctl disable prometheus-alertmanager.service || true fi  userdel prometheus >\/dev\/null 2>&amp;1 || true groupdel prometheus >\/dev\/null 2>&amp;1 || true  if [ -d \"\/var\/lib\/prometheus\/\" ]; then   rm -rf \/var\/lib\/prometheus\/ fi  if [ -d \"\/etc\/prometheus\/alertmanager_data\/\" ]; then   rm -rf \/etc\/prometheus\/alertmanager_data\/ fi  unlink \/usr\/local\/bin\/prometheus 2>&amp;1 || true unlink \/usr\/local\/bin\/promtool 2>&amp;1 || true unlink \/usr\/local\/bin\/alertmanager 2>&amp;1 || true unlink \/usr\/local\/bin\/amtool 2>&amp;1 || true  echo \" OK\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u00a0\u00ab<strong><em>prometheus-lab_0.1-1_all.deb<\/em><\/strong>\u00bb.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#repo_upload\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c<\/a> \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<h3>Bash-\u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f Prometheus \u0438 AlertManager<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c bash-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 Prometheus \u0438 AlertManager \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:  <\/p>\n<details class=\"spoiler\">\n<summary>prometheus.sh<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/github.com\/justnikobird\/young-devops-project\/blob\/main\/prometheus.sh\" rel=\"noopener noreferrer nofollow\"><strong>\u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430 GitHub<\/strong><\/a>  <\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  # \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043e\u043f\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0435\u0441\u043b\u0438 \u043b\u044e\u0431\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c set -e  # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root if [[ \"${UID}\" -ne 0 ]]; then   echo -e \"You need to run this script as root!\"   exit 1 fi  # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 if [[ ! $(grep -rhE ^deb \/etc\/apt\/sources.list*) == *\"deb https:\/\/repo.justnikobird.ru:1111\/lab focal main\"* ]]; then   echo -e \"Lab repo not connected!\\nPlease run vm_start.sh script!\\n\"   exit 1 fi  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 command_check() {   if ! command -v \"$1\" &amp;>\/dev\/null; then     echo -e \"\\n====================\\n$2 could not be found!\\nInstalling...\\n====================\\n\"     apt-get install -y \"$3\"     echo -e \"\\nDONE\\n\"   fi }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 iptables \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e iptables_add() {   if ! iptables -C \"$@\" &amp;>\/dev\/null; then     iptables -A \"$@\"   fi }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0438 \u0432 linux-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 path_request() {   while true; do     read -r -e -p $'\\n'\"Please input valid path to ${1}: \" path     if [ -f \"$path\" ]; then       echo \"$path\"       break     fi   done }  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e command_check systemctl restart systemd-timesyncd.service apt-get update command_check iptables \"Iptables\" iptables command_check netfilter-persistent \"Netfilter-persistent\" iptables-persistent command_check prometheus \"Prometheus\" prometheus-lab command_check basename \"Basename\" coreutils command_check htpasswd \"Htpasswd\" apache2-utils  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c while true; do   read -r -p $'\\n'\"Privat network (format 10.0.0.0\/24): \" private_net   if [[ ! $private_net =~ ^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\\/[0-9]{1,2}$ ]]; then     echo -e \"\\nPrefix not valid!\\n\"   else     break   fi done  # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables echo -e \"\\n====================\\nIptables configuration\\n====================\\n\" iptables_add INPUT -p tcp --dport 9090 -j ACCEPT -m comment --comment prometheus iptables_add INPUT -p tcp --dport 9093 -j ACCEPT -m comment --comment prometheus_alertmanager iptables_add OUTPUT -p tcp --dport 587 -j ACCEPT -m comment --comment smtp iptables_add OUTPUT -p tcp -d \"$private_net\" --dport 9100 -j ACCEPT -m comment --comment prometheus_node_exporter iptables_add OUTPUT -p tcp -d \"$private_net\" --dport 9176 -j ACCEPT -m comment --comment prometheus_openvpn_exporter iptables_add OUTPUT -p tcp -d \"$private_net\" --dport 9113 -j ACCEPT -m comment --comment prometheus_nginx_exporter echo -e \"\\n====================\\nSaving iptables config\\n====================\\n\" service netfilter-persistent save echo -e \"\\nDONE\\n\"  # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 HTTPS echo -e \"\\n====================\\nHTTPS configuration\\n====================\\n\"  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 cert_path=$(path_request certificate) cp \"$cert_path\" \/etc\/prometheus\/ cert_file=$(basename \"$cert_path\") chmod 640 \/etc\/prometheus\/\"$cert_file\" chown prometheus:prometheus \/etc\/prometheus\/\"$cert_file\"  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u043b\u044e\u0447\u0430, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 key_path=$(path_request key) cp \"$key_path\" \/etc\/prometheus\/ key_file=$(basename \"$key_path\") chmod 640 \/etc\/prometheus\/\"$key_file\" chown prometheus:prometheus \/etc\/prometheus\/\"$key_file\"  # \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e prometheus \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 while true; do   read -r -n 1 -p $'\\n\\n'\"Add exporter's certificate to prometheus directory? (y|n) \" yn   case $yn in   [Yy]*)     echo -e \"\\n\"     exp_cert_path=$(path_request certificate)     cp \"$exp_cert_path\" \/etc\/prometheus\/     exp_cert_file=$(basename \"$exp_cert_path\")     chmod 640 \/etc\/prometheus\/\"$exp_cert_file\"     chown prometheus:prometheus \/etc\/prometheus\/\"$exp_cert_file\"     ;;    [Nn]*)     echo -e \"\\n\"     break     ;;    *) echo -e \"\\nPlease answer Y or N!\\n\" ;;   esac done  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c username \u0438 password \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 read -r -p $'\\n'\"Prometheus username: \" username read -r -p $'\\n'\"Prometheus password: \" -s password  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f prometheus \u043a alertmanager read -r -p $'\\n\\n'\"Prometheus domain name (format monitor.justnikobird.ru): \" domain_name  # \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \/etc\/prometheus\/web.yml echo -e \"tls_server_config:\\n  cert_file: $cert_file\\n  key_file: $key_file\\n\\nbasic_auth_users:\\n  $username: '$(htpasswd -nbB -C 10 admin \"$password\" | grep -o \"\\$.*\")'\" >\/etc\/prometheus\/web.yml  # \u0432\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \/etc\/prometheus\/prometheus.yml \u0432 \u0431\u043b\u043e\u043a alerting sed -r -i '0,\/(^.*\\susername:\\s).*$\/s\/\/\\1'\"$username\"'\/' \/etc\/prometheus\/prometheus.yml sed -r -i '0,\/(^.*\\spassword:\\s).*$\/s\/\/\\1'\"$password\"'\/' \/etc\/prometheus\/prometheus.yml sed -r -i '0,\/(^.*\\sca_file:\\s).*$\/s\/\/\\1'\"$cert_file\"'\/' \/etc\/prometheus\/prometheus.yml sed -r -i \"0,\/(^.*\\stargets:\\s).*\/s\/\/\\1['$domain_name:9093']\/\" \/etc\/prometheus\/prometheus.yml  # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 DNS echo -e \"\\n\\n====================\\nDNS configuration\\n====================\\n\"  # \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u043c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f prometheus \u0437\u0430 \u0430\u0434\u0440\u0435\u0441\u043e\u043c localhost if ! grep -Fxq \"127.0.0.1 $domain_name\" \/etc\/hosts &amp;>\/dev\/null; then   echo \"127.0.0.1 $domain_name\" >>\/etc\/hosts   echo -e \"\\nString '127.0.0.1 $domain_name' added to \/etc\/hosts\\n\\n\" fi  echo -e \"\/etc\/hosts file content:\\n\\n\" cat \/etc\/hosts  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \/etc\/hosts while true; do   read -r -n 1 -p $'\\n\\n'\"Add new string to \/etc\/hosts? (y|n) \" yn   case $yn in   [Yy]*)     while true; do       read -r -p $'\\n\\n'\"Enter string in format '&lt;ip> &lt;domain>': \" domain_str       if [[ $domain_str =~ ^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}[[:blank:]][a-z\\.]+$ ]]; then         echo \"$domain_str\" >>\/etc\/hosts         echo -e \"\\n\\n\/etc\/hosts file content:\\n\\n\"         cat \/etc\/hosts         break       else         echo -e \"\\nWrong string format!\\n\"       fi     done     ;;    [Nn]*)     echo -e \"\\n\"     break     ;;    *) echo -e \"\\nPlease answer Y or N!\\n\" ;;   esac done  # \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u044b prometheus \u0438 alertmanager echo -e \"\\nDONE\\n\" systemctl daemon-reload systemctl restart prometheus.service systemctl enable prometheus.service systemctl restart prometheus-alertmanager.service systemctl enable prometheus-alertmanager.service  echo -e \"\\n====================\\nPrometheus listening on port 9090\\nAlertmanager listening on port 9093\\n====================\\n\" echo -e \"\\nOK\\n\" exit 0<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0417\u0430\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 Prometheus \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442 \u0438 \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<hr\/>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Grafana<\/h2>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb, \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 Grafana \u0432\u0435\u0440\u0441\u0438\u0438 10.1.1 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u0420\u043e\u0441\u0441\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 VPN) \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443: <\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/dl.grafana.com\/enterprise\/release\/grafana-enterprise_10.1.1_amd64.deb sudo apt-get install -y ~\/grafana-enterprise_10.1.1_amd64.deb<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Grafana \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS<\/h3>\n<p>\u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u043d\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#issue\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e<\/u><\/a> \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 Prometheus \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e Grafana \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">sudo cp \/etc\/prometheus\/monitor.justnikobird.ru.crt \/etc\/grafana\/ sudo cp \/etc\/prometheus\/monitor.justnikobird.ru.key \/etc\/grafana\/ sudo chown root:grafana \/etc\/grafana\/monitor.justnikobird.ru.* sudo chmod 640 \/etc\/grafana\/monitor.justnikobird.ru.*<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 https \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u00ab<em>\/etc\/grafana\/grafana.ini<\/em>\u00bb \u0432 \u0431\u043b\u043e\u043a\u0435 \u00abserver\u00bb:<\/p>\n<pre><code class=\"bash\">[server] protocol = https domain = monitor.justnikobird.ru cert_file = \/etc\/grafana\/monitor.justnikobird.ru.crt cert_key = \/etc\/grafana\/monitor.justnikobird.ru.key<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Grafana \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart grafana-server.service sudo systemctl enable grafana-server.service<\/code><\/pre>\n<p>C\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 3000.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT -m comment --comment grafana<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043a\u0435\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u00ab<a href=\"https:\/\/monitor.justnikobird.ru:3000\/login\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/monitor.justnikobird.ru:3000<\/strong><\/a>\u00bb<strong> <\/strong>\u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Grafana \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u00abadmin\u00bb. <\/p>\n<h3>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Prometheus \u043a Grafana<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u00abConnections\u00bb, \u0437\u0430\u0442\u0435\u043c \u00abData sources\u00bb:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc4\/5b0\/908\/fc45b09086d520435b7653c211e47062.png\" width=\"996\" height=\"393\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fc4\/5b0\/908\/fc45b09086d520435b7653c211e47062.png\"\/><\/figure>\n<p>\u041d\u0430\u0436\u043c\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u00abAdd data source\u00bb, \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u00abPrometheus\u00bb \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a88\/e79\/748\/a88e79748154f5a9f531a1765f9ab6c0.png\" width=\"501\" height=\"683\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a88\/e79\/748\/a88e79748154f5a9f531a1765f9ab6c0.png\"\/><\/figure>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 dashboard<\/h3>\n<p>\u0414\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9bf\/3dd\/46c\/9bf3dd46c5690341e45078d4f311c374.png\" width=\"1125\" height=\"373\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9bf\/3dd\/46c\/9bf3dd46c5690341e45078d4f311c374.png\"\/><\/figure>\n<h3>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 deb-\u043f\u0430\u043a\u0435\u0442\u0430 Grafana \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/h3>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0430\u043a\u0435\u0442 Grafana \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 VPN, \u0442\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0435\u0440\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u00ab<em>grafana-enterprise_10.1.1_amd64.deb<\/em>\u00bb \u0438 \u0441\u043c\u0435\u043d\u0438\u043c \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u00abgrafana-lab\u00bb:<\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/783076\/#rebuild\" rel=\"noopener noreferrer nofollow\"><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 DEB-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438<\/strong><\/a><strong>\u00bb<\/strong>.<\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u00a0\u00ab<strong><em>grafana-lab_10.1.1_amd64.deb<\/em><\/strong>\u00bb  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#repo_upload\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c<\/a> \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.  <\/p>\n<h3>Bash-\u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f Grafana<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c bash-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 Grafana \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:  <\/p>\n<details class=\"spoiler\">\n<summary>grafana.sh<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/github.com\/justnikobird\/young-devops-project\/blob\/main\/grafana.sh\" rel=\"noopener noreferrer nofollow\"><strong>\u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430 GitHub<\/strong><\/a>  <\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  # \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043e\u043f\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0435\u0441\u043b\u0438 \u043b\u044e\u0431\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c set -e  # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root if [[ \"${UID}\" -ne 0 ]]; then   echo -e \"You need to run this script as root!\"   exit 1 fi  # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 if [[ ! $(grep -rhE ^deb \/etc\/apt\/sources.list*) == *\"deb https:\/\/repo.justnikobird.ru:1111\/lab focal main\"* ]]; then   echo -e \"Lab repo not connected!\\nPlease run vm_start.sh script!\\n\"   exit 1 fi  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 command_check() {   if ! command -v \"$1\" &amp;>\/dev\/null; then     echo -e \"\\n====================\\n$2 could not be found!\\nInstalling...\\n====================\\n\"     apt-get install -y \"$3\"     echo -e \"\\nDONE\\n\"   fi }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 iptables \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e iptables_add() {   if ! iptables -C \"$@\" &amp;>\/dev\/null; then     iptables -A \"$@\"   fi }  # \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0438 \u0432 linux-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 path_request() {   while true; do     read -r -e -p $'\\n'\"Please input valid path to ${1}: \" path     if [ -f \"$path\" ]; then       echo \"$path\"       break     fi   done }  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e command_check systemctl restart systemd-timesyncd.service apt-get update command_check iptables \"Iptables\" iptables command_check netfilter-persistent \"Netfilter-persistent\" iptables-persistent command_check basename \"Basename\" coreutils command_check grafana-server \"Grafana\" grafana-lab  # \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c iptables echo -e \"\\n====================\\nIptables configuration\\n====================\\n\" iptables_add INPUT -p tcp --dport 3000 -j ACCEPT -m comment --comment grafana echo -e \"\\n====================\\nSaving iptables config\\n====================\\n\" service netfilter-persistent save echo -e \"\\nDONE\\n\"  # \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c https echo -e \"\\n====================\\nHTTPS configuration\\n====================\\n\"  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b cert_path=$(path_request certificate) cp \"$cert_path\" \/etc\/grafana\/ # \u043e\u0442\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043e\u0442 \u043f\u0443\u0442\u0438 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f cert_file=$(basename \"$cert_path\") chmod 640 \/etc\/grafana\/\"$cert_file\" chown root:grafana \/etc\/grafana\/\"$cert_file\"  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b key_path=$(path_request key) cp \"$key_path\" \/etc\/grafana\/ # \u043e\u0442\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043e\u0442 \u043f\u0443\u0442\u0438 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f key_file=$(basename \"$key_path\") chmod 640 \/etc\/grafana\/\"$key_file\" chown root:grafana \/etc\/grafana\/\"$key_file\"  # \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f read -r -e -p $'\\n'\"Please input domain name (example: monitor.justnikobird.ru): \" domain  # \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b grafana sed -i 's\/^\\;\\(protocol\\).*$\/\\1 = https\/' \/etc\/grafana\/grafana.ini sed -i 's\/^\\;\\(domain\\).*$\/\\1 = '\"$domain\"'\/' \/etc\/grafana\/grafana.ini sed -i 's@^\\;\\(cert_file\\).*$@\\1 = \/etc\/grafana\/'\"$cert_file\"'@' \/etc\/grafana\/grafana.ini sed -i 's@^\\;\\(cert_key\\).*$@\\1 = \/etc\/grafana\/'\"$key_file\"'@' \/etc\/grafana\/grafana.ini  echo -e \"\\nDONE\\n\"  # \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 grafana systemctl daemon-reload systemctl restart grafana-server.service systemctl enable grafana-server.service  echo -e \"\\n====================\\nGrafana listening on port 3000\\n====================\\n\" echo -e \"\\nOK\\n\" exit 0<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430, \u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/781132\/\" rel=\"noopener noreferrer nofollow\"><strong>Cisco TRex \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/strong><\/a>\u00bb.  <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/783572\/\"> https:\/\/habr.com\/ru\/articles\/783572\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u043f\u0438\u0441\u0430\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e pet-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430 \u0432 DevOps:<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/781746\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 1: \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043d\u0434\u0430<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/789056\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 2: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0446\u0435\u043d\u0442\u0440\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/783304\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 3: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenVPN<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/783572\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043b\u0430\u0432\u0430 4: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/strong><\/a><\/p>\n<blockquote>\n<p>\u0414\u0440\u0443\u0437\u044c\u044f, \u0445\u043e\u0447\u0443 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 DevOps &#8212; Terraform, Ansible, Kubernetes, GitLab CI\/CD \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e DevOps \u0431\u0435\u0437 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442.<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 DevOps \u0438 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u0417\u0434\u0435\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0430\u043a\u0446\u0435\u043d\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e pet-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 &#8212; \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0441 Linux \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 DevOps &#8212; \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00ab\u041f\u0440\u043e\u0435\u043a\u0442\u00a0<strong>\u044e\u043d\u043e\u0433\u043e<\/strong>\u00a0DevOps\u00bb. \u0412 \u043f\u043b\u0430\u043d\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0443\u0436\u0435 \u0441 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u0435\u043c \u0432 DevOps \u0438 \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u0442\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e. \u041f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u043e\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043d\u0438\u0435, \u0432\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0434\u043d\u044f!<\/p>\n<\/blockquote>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Prometheus<\/h2>\n<p>Prometheus \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439, \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0435 \u0438\u0437 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u0432 Time Series Database (TSDB). \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SQl-like \u0421\u0423\u0411\u0414, Prometheus \u0441\u0430\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0445\u043e\u0441\u0442\u0430\u043c. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u0432 Prometheus \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441 PromQL. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0438\u043b\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0435.<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c bash-\u0441\u043a\u0440\u0438\u043f\u0442 \u00abvm-start.sh\u00bb \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 Prometheus:<\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Prometheus \u0432\u0435\u0440\u0441\u0438\u0438 2.47.0 c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/prometheus\/prometheus\/releases\/download\/v2.47.0\/prometheus-2.47.0.linux-amd64.tar.gz tar xvf ~\/prometheus-2.47.0.linux-amd64.tar.gz &amp;&amp; cd ~\/prometheus-2.47.0.linux-amd64 sudo cp prometheus \/usr\/bin\/ sudo cp promtool \/usr\/bin\/ sudo ln -s \/usr\/bin\/prometheus \/usr\/local\/bin\/prometheus sudo ln -s \/usr\/bin\/promtool \/usr\/local\/bin\/promtool sudo mkdir \/etc\/prometheus sudo cp prometheus.yml \/etc\/prometheus sudo cp -r consoles \/etc\/prometheus sudo cp -r console_libraries \/etc\/prometheus sudo mkdir \/var\/lib\/prometheus<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Prometheus \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439<\/h3>\n<p>\u041d\u0430 vm \u00abca\u00bb <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#issue\" rel=\"noopener noreferrer nofollow\">\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c<\/a> \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u043d\u0430 vm \u00abmonitor\u00bb \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u00ab<em>\/etc\/prometheus<\/em>\u00bb:<\/p>\n<pre><code class=\"bash\">sudo cp ~\/monitor.justnikobird.ru.crt \/etc\/prometheus\/ sudo cp ~\/monitor.justnikobird.ru.key \/etc\/prometheus\/<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0445\u044d\u0448 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f &#8212; \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u00abpassword\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abadmin\u00bb:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y apache2-utils htpasswd -nbB -C 10 admin \"password\"<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"bash\">admin:$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u00ab<em>\/etc\/prometheus\/web.yml<\/em>\u00bb, \u043a\u0443\u0434\u0430 \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 https:<\/p>\n<pre><code class=\"bash\">tls_server_config:   # Certificate and key files for server to use to authenticate to client.   cert_file: monitor.justnikobird.ru.crt   key_file: monitor.justnikobird.ru.key  basic_auth_users:   admin: '$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS'<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u00abprometheus\u00bb \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo addgroup --system \"prometheus\" --quiet sudo adduser --system --home \/usr\/share\/prometheus --no-create-home --ingroup \"prometheus\" --disabled-password --shell \/bin\/false \"prometheus\"<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0441\u044c&#187; data-title=&#187;&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417&#187;>\u0422\u0423\u0417<\/abbr> \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chown -R prometheus:prometheus \/var\/lib\/prometheus\/ sudo chmod -R 755 \/var\/lib\/prometheus\/ sudo chown -R prometheus:prometheus \/etc\/prometheus\/ sudo chmod -R 755 \/etc\/prometheus\/ sudo chmod 640 \/etc\/prometheus\/*.crt sudo chmod 640 \/etc\/prometheus\/*.key sudo chown prometheus:prometheus \/usr\/bin\/prometheus sudo chown -h prometheus:prometheus \/usr\/local\/bin\/prometheus sudo chmod 755 \/usr\/bin\/prometheus sudo chown prometheus:prometheus \/usr\/bin\/promtool sudo chown -h prometheus:prometheus \/usr\/local\/bin\/promtool sudo chmod 755 \/usr\/bin\/promtool<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h3>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/prometheus.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Prometheus:<\/p>\n<pre><code class=\"bash\">[Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=\/usr\/bin\/prometheus \\ --config.file \/etc\/prometheus\/prometheus.yml \\ --storage.tsdb.path \/var\/lib\/prometheus\/ \\ --web.console.templates=\/etc\/prometheus\/consoles \\ --web.console.libraries=\/etc\/prometheus\/console_libraries \\ --web.config.file=\/etc\/prometheus\/web.yml [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Prometheus \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart prometheus.service sudo systemctl enable prometheus.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 Prometheus \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9090.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp --dport 9090 -j ACCEPT -m comment --comment prometheus<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u00ab<a href=\"https:\/\/monitor.justnikobird.ru:9090\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/monitor.justnikobird.ru:9090<\/strong><\/a><strong>\u00bb <\/strong>\u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Prometheus \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<hr\/>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432<\/h2>\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u044b Prometheus \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0435\u043d Prometheus. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 Prometheus \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Node Exporter<\/h3>\n<p>Node Exporter &#8212; \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0443\u0437\u043b\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0443\u0437\u043b\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CPU, \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0430 \u0432\u0441\u0435 vm \u0441\u0442\u0435\u043d\u0434\u0430.<\/p>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 vm \u0438 \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Node Exporter \u0432\u0435\u0440\u0441\u0438\u0438 1.6.1  c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 GitHub \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443:<\/p>\n<pre><code class=\"bash\">wget -P ~\/ https:\/\/github.com\/prometheus\/node_exporter\/releases\/download\/v1.6.1\/node_exporter-1.6.1.linux-amd64.tar.gz tar xvf ~\/node_exporter-1.6.1.linux-amd64.tar.gz &amp;&amp; cd ~\/node_exporter-1.6.1.linux-amd64 sudo cp node_exporter \/usr\/bin\/ sudo mkdir \/opt\/node_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Node Exporter \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/p>\n<\/div>\n<\/details>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 HTTPS c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439<\/h4>\n<p>\u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0440\u0430\u043d\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/articles\/789056\/#issue\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e<\/a> \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f vm \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430:<\/p>\n<pre><code>sudo cp ~\/example.justnikobird.ru.crt \/opt\/node_exporter\/ sudo cp ~\/example.justnikobird.ru.key \/opt\/node_exporter\/<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0445\u044d\u0448 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f &#8212; \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u00abpassword\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abadmin\u00bb:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y apache2-utils htpasswd -nbB -C 10 admin \"password\"<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"bash\">admin:$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u00ab<em>\/opt\/node_exporter\/web.yml<\/em>\u00bb, \u043a\u0443\u0434\u0430 \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 https:<\/p>\n<pre><code class=\"bash\">tls_server_config:   # Certificate and key files for server to use to authenticate to client.   cert_file: example.justnikobird.ru.crt   key_file: example.justnikobird.ru.key  basic_auth_users:   admin: '$2y$10$iWOlBiff2IDDovW2wy2SauStp7ahuHpOULM2W7yQ6JpNcbDKeBPYS'<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u00abnode_exporter\u00bb \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo addgroup --system \"node_exporter\" --quiet sudo adduser --system --home \/usr\/share\/prometheus --no-create-home --ingroup \"node_exporter\" --disabled-password --shell \/bin\/false \"node_exporter\"<\/code><\/pre>\n<p>\u0412\u044b\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0430 <abbr class=\"habraabbr\" title=\"\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c\" data-title=\"&lt;p>\u0441\u044c&#187; data-title=&#187;&lt;p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0423\u0447\u0435\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c&lt;\/p>&#187; data-abbr=&#187;\u0422\u0423\u0417&#187;>\u0422\u0423\u0417<\/abbr> \u043d\u0430 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"bash\">sudo chmod 755 \/usr\/bin\/node_exporter sudo chown node_exporter:node_exporter \/usr\/bin\/node_exporter sudo chmod -R 755 \/opt\/node_exporter\/ sudo chmod 640 \/opt\/node_exporter\/*.crt sudo chmod 640 \/opt\/node_exporter\/*.key sudo chown -R node_exporter:node_exporter \/opt\/node_exporter\/<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 systemd unit<\/h4>\n<p>\u041e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abroot\u00bb \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c systemd-\u044e\u043d\u0438\u0442 \u00ab<em>\/etc\/systemd\/system\/node_exporter.service<\/em>\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Node Exporter:<\/p>\n<pre><code class=\"bash\">[Unit] Description=Prometheus Node Exporter Wants=network-online.target After=network-online.target  [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=\/usr\/bin\/node_exporter --web.config.file=\/opt\/node_exporter\/web.yml  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Node Exporter \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"bash\">sudo systemctl daemon-reload sudo systemctl restart node_exporter.service sudo systemctl enable node_exporter.service<\/code><\/pre>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 9100<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 iptables<\/h4>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 iptables \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u0438\u0437 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 <a href=\"https:\/\/habr.com\/ru\/articles\/781746\/#vm_info\" rel=\"noopener noreferrer nofollow\">\u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/a> \u00ab10.0.0.6\u00bb:<\/p>\n<pre><code class=\"bash\">sudo iptables -A INPUT -p tcp -s 10.0.0.6 --dport 9100 -j ACCEPT -m comment --comment prometheus_node_exporter<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043c\u0435\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Prometheus \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0435\u043d\u0434\u0435.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 iptables-persistent:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y iptables-persistent sudo service netfilter-persistent save<\/code><\/pre>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0430 deb-\u043f\u0430\u043a\u0435\u0442\u0430 Node Exporter<\/h4>\n<p>\u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u00ab<a href=\"https:\/\/habr.com\/ru\/articles\/783076\/\" rel=\"noopener noreferrer nofollow\"><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 DEB-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438<\/strong><\/a>\u00bb. <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u0447\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442\u0435:<\/p>\n<pre><code class=\"bash\">\/opt\/node_exporter\/web.yml \/usr\/bin\/node_exporter \/etc\/systemd\/system\/node_exporter.service<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>install<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">web.yml opt\/node_exporter\/ node_exporter usr\/bin\/ node_exporter.service etc\/systemd\/system\/<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>control<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">Source: node-exporter-lab Section: unknown Priority: optional Maintainer: unknown &lt;nikolay@unknown> Build-Depends: debhelper-compat (=<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-364170","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364170","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=364170"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364170\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}