1. 程式人生 > 其它 >Prometheus監控部署

Prometheus監控部署

參考來源:http://dockone.io/article/2434457

http://dockone.io/article/2434650

官方文件:https://prometheus.io/docs/

https://grafana.com/docs/grafana/

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

https://grafana.com/grafana/download

一、Prometheus是什麼?

監控:資料採集,資料儲存,資料分析,資料展示,資料告警。

Prometheus本質上是一個度量資料的收集和分析工具,包含3個核心元件:

● 時間序列資料庫,用於儲存所有度量資料。

● 資料收集器,負責從外部來源拉取指標並將其推入資料庫。

● Web伺服器,為配置和查詢儲存的資料提供簡單的Web介面。

二、Prometheus的優勢:

配置靈活;

監控多樣性;

高效的儲存;

三、Prometheus的架構:

 說明:

PromSQL,是用於從Prometheus中檢索指標的查詢語言。

AlertManager(告警管理),允許我們根據Prometheus取樣的指標定義告警(比如記憶體/ CPU使用率過高或請求時延達到峰值)。

Pushgateway(推送閘道器),允許應用和服務將指標推送到Prometheus,而非標準的由Prometheus主動拉取。

Service discocery(服務發現),Prometheus在一開始就被設計為只需極少配置即可完成初始安裝,以及適於在諸如Kubernetes之類的動態環境中執行。因此它可以對正在執行的服務進行自動發現,並嘗試對其應監視的內容作出最佳的猜測。

四、prometheus安裝

https://prometheus.io/download/下載相應版本,官網提供的是二進位制版,解壓就能用,不需要編譯。

上傳prometheus包,並解壓

tar -zxvf prometheus-2.35.0.linux-amd64.tar.gz

mv prometheus-2.35.0.linux-amd64 /usr/local/prometheus

cd /usr/local/prometheus/

#啟動

./prometheus &

  

#檢視相關程序及埠

ps -ef |grep prometheus

ss -anltp |grep 9090

netstat -nltp |grep prometheus

瀏覽器訪問驗證Prometheus,直接輸入伺服器IP:9090即可。