{"id":332,"date":"2020-03-31T18:48:33","date_gmt":"2020-03-31T10:48:33","guid":{"rendered":"http:\/\/opensource.dwins.com\/?p=332"},"modified":"2020-04-13T17:17:08","modified_gmt":"2020-04-13T09:17:08","slug":"%e5%9c%a8windows-%e7%92%b0%e5%a2%83%e4%b8%8b%e5%ae%89%e8%a3%9d-wmi_exporter-prometheus%e5%92%8cgrafana","status":"publish","type":"post","link":"https:\/\/opensource.dwins.com\/?p=332","title":{"rendered":"\u5728Windows \u74b0\u5883\u4e0b\u5b89\u88dd wmi_exporter, Prometheus\u548cGrafana"},"content":{"rendered":"\n<p>Node_exporter\u3001Prometheus &amp; Grafana \u53ef\u4ee5\u5728Windows \u6216\u662fLinux \u7684\u4f5c\u696d\u7cfb\u7d71\u4e2d\u5b89\u88dd\u548c\u76e3\u63a7\u3002\u5728\u6b64\u6587\u7ae0\uff0c\u55ae\u7d14\u7684\u5c07\u6240\u6709\u8edf\u9ad4\u5b89\u88dd\u5728Windows \u74b0\u5883\u4e2d(\u76e3\u8996\u8edf\u9ad4prometheus\u548c\u5100\u8868\u7248Grafana)\uff0c\u540c\u6a23\u7684\u4e5f\u662f\u53ea\u76e3\u770b Windows \u4e3b\u6a5f\u4e0a\u7684\u670d\u52d9(wmi_exporter)\u3002\u4ee5\u4e0b\u70ba\u5de5\u4f5c\u7684\u6b65\u9a5f\uff0c\u5728\u5b89\u88dd\u6216\u8a66\u9a57\u524d\u61c9\u8a72\u5c07\u8981\u5b89\u88dd\u7684\u74b0\u5883\u548c\u76e3\u770b\u7684\u8cc7\u6e90\u5148\u898f\u5283\u597d\u4e4b\u5f8c\u518d\u4f86\u5b89\u88dd:<\/p>\n\n\n\n<ul><li>\u5b89\u88ddPrometheus , \u4e26\u4e14\u4f9d\u898f\u5283\u7684\u5167\u5bb9\u4fee\u6539 Prometheus.yml (\u5728Windows \u4e2d\u82e5\u8981\u4ee5\u670d\u52d9\u57f7\u884c\u8acb\u7528nssm),<\/li><li>\u5b89\u88dd wmi_exporter \u5230&#8221;\u88ab\u76e3\u63a7\u7684\u4f3a\u670d\u5668&#8221;, <\/li><li>\u5b89\u88dd Grafana \u4e26\u532f\u5165\u5100\u8868\u7248\u6a23\u672c.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prometheus<\/h2>\n\n\n\n<ul><li>\u5b89\u88dd Prometheus:<ul><li>\u89e3\u58d3<a href=\"http:\/\/prometheus-2.17.1.windows-amd64.tar.gz\">prometheus-2.15.0.windows-amd64.tar<\/a><\/li><li>\u57f7\u884cwinZIP<\/li><li>\u5c07\u7a0b\u5f0f\u8907\u88fd\u5230C:\\Prometheus <\/li><\/ul><\/li><li>\u8a2d\u5b9a:<ul><li> \u7a0b\u5f0f\u5b89\u88dd\u6642\u9810\u8a2d\u7684PORT \u662f 9090, \u82e5\u8981\u8b8a\u52d5PORT \u6578\u53ca\u544a\u8b66\u8acb\u4fee\u6539 Prometheus.yml<\/li><li>\u5b89\u88dd\u5b8c\u6210\u5f8c\u53ea\u6709\u9810\u8a2d\u7684 Prometheus \u7684\u53c3\u6578\u6e2c\u91cf\u503c, \u53ef\u4ee5\u9023\u5230 hppt:\/\/localhost:9090\/graph, \u5728[Execute]\u53f3\u65b9\u9078\u64c7\u4e00\u500b\u6e2c\u91cf\u503cmetric \u4f86\u6aa2\u8996 <\/li><\/ul><\/li><\/ul>\n\n\n\n<div class=\"wp-block-media-text alignwide\"><figure class=\"wp-block-media-text__media\"><img decoding=\"async\" loading=\"lazy\" width=\"312\" height=\"239\" src=\"https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image.png\" alt=\"\" class=\"wp-image-334\" srcset=\"https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image.png 312w, https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-300x230.png 300w\" sizes=\"(max-width: 312px) 100vw, 312px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Prometheus \u7684\u5716\u5f62\u4ecb\u9762\u53ef\u4ee5\u4f7f\u7528PromQL \u8a9e\u8a00\u67e5\u8a62\u8cc7\u6599\uff0c\u4e5f\u53ef\u4ee5\u986f\u793a\u5716\u5f62\u3002\u4f46\u82e5\u8981\u9032\u968e\u7684\u5100\u8868\u5716\u8acb\u4f7f\u7528 Grafana<\/p>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">wmi_exporter<\/h2>\n\n\n\n<ul><li>\u5b89\u88dd wmi_exporter:<ul><li>\u4e0b\u8f09<a href=\"https:\/\/github.com\/martinlindhe\/wmi_exporter\/releases\/download\/v0.11.0\/wmi_exporter-0.11.0-amd64.msi\">wmi_exporter-0.9.0-amd64.msi<\/a><\/li><li>\u5b89\u88dd\u4e26\u6210\u70ba\u670d\u52d9, <\/li><\/ul><\/li><li>\u8a2d\u5b9a:<ul><li> \u4ee5Browser \u9023\u63a5\u5230 <a href=\"http:\/\/localhost:9182\">http:\/\/localhost:9182<\/a> , \u9810\u8a2dPORT = 9182, \u6aa2\u67e5\u662f\u5426\u53ef\u770b\u5230\u4e0b\u5716\u7684\u756b\u9762<\/li><li> \u4fee\u6539prometheus.yml \u5c07node \u52a0\u5165\u76e3\u63a7 <\/li><li>\u53ef\u4ee5\u56de\u5230 Prometheus (<a href=\"http:\/\/localhost:9090\">http:\/\/localhost:9090<\/a>) \u53ef\u4ee5\u770b\u5230\u9019\u500b\u8cc7\u6e90<\/li><li>Wmi_export \u7684\u8868\u503c\u53ca\u5167\u5bb9, \u8acb<a href=\"https:\/\/github.com\/martinlindhe\/wmi_exporter\">\u8a73\u95b1<\/a>: <\/li><\/ul><\/li><\/ul>\n\n\n\n<div class=\"wp-block-media-text alignwide\"><figure class=\"wp-block-media-text__media\"><img decoding=\"async\" loading=\"lazy\" width=\"459\" height=\"316\" src=\"https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-1.png\" alt=\"\" class=\"wp-image-335\" srcset=\"https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-1.png 459w, https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-1-300x207.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p class=\"has-small-font-size\">scrape_configs:<\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp; # The job name is added as a\nlabel `job=&lt;job_name&gt;` to any timeseries scraped from this config.<\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp; &#8211; job_name: &#8216;node&#8217;<\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp; static_configs:<\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp; &#8211; targets: [&#8216;localhost:9182&#8217;]<\/p>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Grafana<\/h2>\n\n\n\n<ul><li>\u5b89\u88dd wmi_exporter:<ul><li>\u4e0b\u6234 <a href=\"https:\/\/dl.grafana.com\/oss\/release\/grafana-6.7.2.windows-amd64.msi\">grafana-6.5.2.windows-amd64.msi<\/a><\/li><li>\u5b89\u88dd\u4e26\u6210\u70ba\u670d\u52d9,<\/li><li> \u4ee5Browser \u9023\u63a5\u5230 <a href=\"http:\/\/localhost:5000\">http:\/\/localhost:3000<\/a> , \u9810\u8a2dPORT = 3000 , \u53ef\u6539\u70ba5000 <\/li><\/ul><\/li><li>\u8a2d\u5b9a:<ul><li> \u8a2d\u5b9aData Source \u70ba Prometheus,<\/li><li>\u4e0b\u8f09Dashboard \u7684<a href=\"https:\/\/grafana.com\/grafana\/dashboards\/10467\">JSON<\/a> \u6a94, ( 3 wmi_exporter 0.7.0+ for Prometheus )<\/li><li>\u6216\u662f, \u53ef\u4ee5\u5728[\u63a7\u5236\u53f0]\u7684[+] , \u9078\u64c7[import]\u4e0a\u50b3<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>: <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"554\" height=\"274\" src=\"https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-2.png\" alt=\"\" class=\"wp-image-338\" srcset=\"https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-2.png 554w, https:\/\/opensource.dwins.com\/wp-content\/uploads\/2020\/04\/image-2-300x148.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node_exporter\u3001Prometheus &amp; Grafana \u53ef\u4ee5\u5728Windows \u6216\u662fLin &#8230; <a title=\"\u5728Windows \u74b0\u5883\u4e0b\u5b89\u88dd wmi_exporter, Prometheus\u548cGrafana\" class=\"read-more\" href=\"https:\/\/opensource.dwins.com\/?p=332\">\u95b1\u8b80\u66f4\u591a <span class=\"screen-reader-text\">\u5728Windows \u74b0\u5883\u4e0b\u5b89\u88dd wmi_exporter, Prometheus\u548cGrafana<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[25,24,23],"_links":{"self":[{"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=\/wp\/v2\/posts\/332"}],"collection":[{"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=332"}],"version-history":[{"count":5,"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=\/wp\/v2\/posts\/332\/revisions"}],"predecessor-version":[{"id":437,"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=\/wp\/v2\/posts\/332\/revisions\/437"}],"wp:attachment":[{"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opensource.dwins.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}