kubernetes實戰(三十一):Prometheus監控Windows主機


1. 基本說明

  使用Prometheus監控Windows主機和Linux主機並無太大區別,都是使用社區的Exporter進行采集數據,之后暴露一個接口,可以讓Prometheus采集到主機的數據。

  其中監控Linux的Exporter是:https://github.com/prometheus/node_exporter

  監控Windows主機的Exporter是:https://github.com/prometheus-community/windows_exporter

   [**前沿技術,快人一步,點我了解~**](https://ke.qq.com/course/2738602)

2. 安裝Windows Exporter

  無論是監控Linux還是Windows,對應的exporter都提供了二進制文件和msi文件,Windows可以直接下載最新的msi文件,然后安裝到對應的Windows主機上即可。

  MSI文件下載地址:https://github.com/prometheus-community/windows_exporter/releases

  下載對應的msi即可:

  

 

   下載完成后,雙擊打開即可完成安裝:

  

 

   之后可以在任務管理器上看到對應的進程:

  

 

   測試是否有數據產生,默認的端口為9182,path為metrics:

  

 

 

3. 配置Prometheus采集數據

 

   在Prometheus的配置文件中添加如下配置:

- job_name: 'WindowsServerMonitor'
  static_configs:
    - targets:
      - "10.101.3.3:9182"
      labels:
        server_type: 'windows'
  relabel_configs:
    - source_labels: [__address__]
      target_label: instance

  檢查Prometheus是否有數據產生:

  

 

 

4. 配置Grafana展示數據

  下載模板:https://grafana.com/grafana/dashboards/12566

  數據展示如下:

 

 

 

 

  

  

   歡迎大家學習2020年最新版kubernetes:https://ke.qq.com/course/2738602?from=800004101#term_id=102846072

    

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM