(Windows版)Prometheus+Grafana環境搭建


1、Prometheus的安裝

下載地址:https://prometheus.io/download/

 

 下載好之后進行解壓。如下圖所示:

 

 雙擊prometheus.exe即可啟動prometheus。

之后我們打開瀏覽器輸入http://localhost:9090,顯示如下界面即啟動成功

 

 

 

Targets界面如下圖所示。

 

 

 2、grafana的安裝

下載地址:https://grafana.com/grafana/download?platform=windows

 

 下載完畢后進行解壓,解壓結果如下:

 

 啟動程序在bin目錄中。

 

 

這里的客戶端應該就是我們去操作grafana-server的一些服務吧。grafana-server就是我們的web端,雙擊打開即可。

隨后打開瀏覽器輸入http://localhost:3000即可進入grafana

初始的登陸賬戶和密碼是:admin/admin

隨后便會要求設置初始密碼。

grafana頁面基本如下。

 

 現在我們要監控prometheus,但是grafana還么有跟prometheus建立聯系,那么作為數據源,需要設置一下數據源。

 

 

 

 

 

 

 

 

 

 

 

 點擊Prometheus 2.0 Stats 即可查看,效果圖如下所示:

 

 3、監控windows機器

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

 

 (1)被監控windows機器安裝windows_exporter,會自動創建一個開機自啟的服務

 

接下來的操作都是服務器端得操作:

服務端機器打開prometheus.yml配置文件

 

 

 在配置文件后面加上

  - job_name: '152'
  
    static_configs:
      - targets: ['192.168.199.152:9182']

  

 如下圖所示(切記格式一定要正確,錯誤的格式將會無法啟動或者無法在表中顯示)

 

 

 重啟Prometheus服務即可生效

 

導入新的表盤

dashboards網址:https://grafana.com/grafana/dashboards

 

 

 

 導入監控的表盤

 

 我已經導入過了,所以會這樣顯示

監控視圖如下所示

 


免責聲明!

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



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