{"id":6984,"date":"2022-12-21T08:04:27","date_gmt":"2022-12-20T23:04:27","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=6984"},"modified":"2022-12-23T06:55:57","modified_gmt":"2022-12-22T21:55:57","slug":"prometheus%e3%81%aenode_exporter%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b%ef%bc%81%ef%bc%88rocky-linux-9%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/6984","title":{"rendered":"Prometheus\u306eNode Exporter\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\uff01\uff08Rocky Linux 9\uff09"},"content":{"rendered":"<p>Prometheus\u306eNode Exporter\u3092Rocky Linux 9\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<h2>Prometheus\u306eNode Exporter\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\uff01<\/h2>\n<p>Node Exporter\u7528\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ mkdir -p prometheus\/node_exporter\r\n$ cd prometheus\/node_exporter\r\n<\/pre>\n<p>Prometheus\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u3001GitHub\u304b\u3089Node Exporter\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ wget https:\/\/github.com\/prometheus\/node_exporter\/releases\/download\/v1.5.0\/node_exporter-1.5.0.linux-amd64.tar.gz\r\n$ ls -l\r\ntotal 9944\r\n-rw-r--r--. 1 usradmin usradmin 10181045 Nov 30 04:05 node_exporter-1.5.0.linux-amd64.tar.gz\r\n<\/pre>\n<h2>Node Exporter\u3092\u5c55\u958b\u3059\u308b\uff01<\/h2>\n<p>Node Exporter\u3092\u5c55\u958b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ tar -zxvf node_exporter-1.5.0.linux-amd64.tar.gz \r\nnode_exporter-1.5.0.linux-amd64\/\r\nnode_exporter-1.5.0.linux-amd64\/LICENSE\r\nnode_exporter-1.5.0.linux-amd64\/NOTICE\r\nnode_exporter-1.5.0.linux-amd64\/node_exporter\r\n<\/pre>\n<h2>Node Exporter\u3092\u8d77\u52d5\u3059\u308b\uff01<\/h2>\n<p>Node Exporter\u3092\u5c55\u958b\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3001Node Exporter\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cd node_exporter-1.5.0.linux-amd64\r\n$ .\/node_exporter\r\n...\r\nts=2022-12-14T20:28:45.438Z caller=tls_config.go:232 level=info msg=&quot;Listening on&quot; address=&#x5B;::]:9100\r\nts=2022-12-14T20:28:45.438Z caller=tls_config.go:235 level=info msg=&quot;TLS is disabled.&quot; http2=false address=&#x5B;::]:9100\r\n<\/pre>\n<h2>Node Exporter\u304c\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>curl\u30b3\u30de\u30f3\u30c9\u3067\u3001Node Exporter\u304c\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ curl http:\/\/localhost:9100\/metrics\r\n...\r\n# TYPE promhttp_metric_handler_requests_total counter\r\npromhttp_metric_handler_requests_total{code=&quot;200&quot;} 0\r\npromhttp_metric_handler_requests_total{code=&quot;500&quot;} 0\r\npromhttp_metric_handler_requests_total{code=&quot;503&quot;} 0\r\n<\/pre>\n<h2>Node Exporter\u3092systemd\u3067\u81ea\u52d5\u8d77\u52d5\u3059\u308b\uff01<\/h2>\n<p>systemd\u306eUnit\u306e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cat  \/etc\/systemd\/system\/node_exporter.service\r\n&#x5B;Unit]\r\nDescription=Node Exporter\r\nDocumentation=https:\/\/github.com\/prometheus\/node_exporter\r\n\r\n&#x5B;Service]\r\nType=simple\r\nExecStart=\/home\/usradmin\/prometheus\/node_exporter\/node_exporter-1.5.0.linux-amd64\/node_exporter\r\nExecStop=\/bin\/kill -TERM ${MAINPID}\r\nExecReload=\/bin\/kill -HUP ${MAINPID}\r\nRestart=always\r\nUser=usradmin\r\n\r\n&#x5B;Install]\r\nWantedBy=multi-user.target\r\n<\/pre>\n<p>Unit\u3092\u767b\u9332\u3057\u3001\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl daemon-reload\r\n$ sudo systemctl enable node_exporter.service\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/node_exporter.service \u2192 \/etc\/systemd\/system\/node_exporter.service.\r\n$ sudo systemctl start node_exporter.service\r\n$ sudo systemctl status node_exporter.service\r\n\u25cf node_exporter.service - Node Exporter\r\n     Loaded: loaded (\/etc\/systemd\/system\/node_exporter.service; enabled; vendor preset: disabled)\r\n     Active: active (running) since Wed 2022-12-21 22:57:06 JST; 15s ago\r\n...\r\n<\/pre>\n<h2>Prometheus\u306e\u30b5\u30fc\u30d0\u5074\u306e\u8a2d\u5b9a\u3092\u884c\u3046\uff01<\/h2>\n<p>\u30b5\u30fc\u30d0\u5074\u306e\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002prometheus.yml\u306e\u6700\u5f8c\u306b\u4ee5\u4e0b\u306e3\u884c\u3092\u8ffd\u52a0\u3057\u3066Prometheus\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002node_exporter\u306f\u3001\u300cvmsans01\u300d\u3068\u3044\u3046\u30b5\u30fc\u30d0\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [32,33,34]; title: ; notranslate\" title=\"\">\r\n$ cat prometheus.yml\r\n# my global config\r\nglobal:\r\n  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.\r\n  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.\r\n  # scrape_timeout is set to the global default (10s).\r\n\r\n# Alertmanager configuration\r\nalerting:\r\n  alertmanagers:\r\n    - static_configs:\r\n        - targets:\r\n          # - alertmanager:9093\r\n\r\n# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.\r\nrule_files:\r\n  # - &quot;first_rules.yml&quot;\r\n  # - &quot;second_rules.yml&quot;\r\n\r\n# A scrape configuration containing exactly one endpoint to scrape:\r\n# Here it's Prometheus itself.\r\nscrape_configs:\r\n  # The job name is added as a label `job=&lt;job_name&gt;` to any timeseries scraped from this config.\r\n  - job_name: &quot;prometheus&quot;\r\n\r\n    # metrics_path defaults to '\/metrics'\r\n    # scheme defaults to 'http'.\r\n\r\n    static_configs:\r\n      - targets: &#x5B;&quot;localhost:9090&quot;]\r\n\r\n  - job_name: &quot;node_exporter&quot;\r\n    static_configs:\r\n      - targets: &#x5B;&quot;vmsans01:9100&quot;]\r\n<\/pre>\n<h2>Node Exporter\u304c\u767b\u9332\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b<\/h2>\n<p>Prometheus\u306e\u30b5\u30fc\u30d0\u540d\u304c\u3001\u300cvmspmt01\u300d\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001Node Exporter\u304c\u8ffd\u52a0\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttp:\/\/vmspmt01:9090\/targets#pool-prometheus\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Prometheus\u306eNode Exporter\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u3068\u3066\u3082\u5bb9\u6613\u3067\u3059\u3002Node Exporter\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u306f\u3001Prometheus\u306e\u30b5\u30fc\u30d0\u5074\u306e\u8a2d\u5b9a\u3092\u884c\u3063\u3066\u76e3\u8996\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003\u60c5\u5831<\/h2>\n<ul>\n<li><a href=\"https:\/\/prometheus.io\/docs\/introduction\/overview\/\" target=\"_blank\" rel=\"noopener\">Prometheus - Overview<\/a><\/li>\n<\/ul>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/6930\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Prometheus\u3067\u904b\u7528\u76e3\u8996\u3092\u884c\u3046\u3002\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/eycatch_prometheus_02-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Prometheus\u3067\u904b\u7528\u76e3\u8996\u3092\u884c\u3046\u3002<\/div><div class=\"substr\">Prometheus\u3067\u904b\u7528\u76e3\u8996\u3092\u884c\u3046\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002...<\/div><\/a><\/div>\n<p>&nbsp;<\/p>\n<h2>Prometheus\u66f8\u7c4d\uff08Amazon\uff09<\/h2>\n<p><iframe sandbox=\"allow-popups allow-scripts allow-modals allow-forms allow-same-origin\" style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=infotecr-22&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=4910313001&linkId=9dc0000731d00570df8bebb953fc3998\"><\/iframe><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prometheus\u306eNode Exporter\u3092Rocky Linux 9\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002 Prometheus\u306eNode Exporter\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\uff01 Node Exporter\u7528\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u79fb\u52d5\u3057\u307e\u3059\u3002 $ \u2026<\/p>\n","protected":false},"author":1,"featured_media":7003,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[179],"tags":[],"class_list":["post-6984","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-prometheus"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=6984"}],"version-history":[{"count":0,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/6984\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/7003"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=6984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=6984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=6984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}