Prometheus 安裝部署
阿新 • • 發佈:2020-12-24
Prometheus 安裝部署
- 安裝版本:prometheus-2.6.1
- 連結:https://pan.baidu.com/s/1QDiitBTpE1uPPJnldEHyNw
提取碼:l21c
二進位制安裝部署
1、下載二進位制包:prometheus-2.15.1.linux-amd64.tar
2、解壓包:tar xvzf prometheus-2.15.1.linux-amd64.tar
3、移動到安裝目錄:mv prometheus-2.15.1.linux-amd64.tar /opt/prometheus
4、進入目錄:cd /opt/prometheus
5、修改配置檔案底部監控本機:vim prometheus.yml
scrape_configs:
- job_name: 'prometheus'
static_configs:
# 監控本地及埠
- targets: ['xiangsikai:9090']
注:Prometheus從目標機上通過http方式拉取取樣點資料, 它也可以拉取自身服務資料並監控自身的健康狀況。
注:當然Prometheus服務拉取自身服務取樣資料,並沒有多大的用處,但是它是一個好的DEMO。
global: # 預設情況下,每15s拉取一次目標取樣點資料。 scrape_interval: 15s # 我們可以附加一些指定標籤到取樣點度量標籤列表中, 用於和第三方系統進行通訊, 包括:federation, remote storage, Alertmanager external_labels: # 下面就是拉取自身服務取樣點資料配置 monitor: 'codelab-monitor' scrape_configs: # job名稱會增加到拉取到的所有采樣點上,同時還有一個instance目標服務的host:port標籤也會增加到取樣點上 - job_name: 'prometheus' # 覆蓋global的取樣點,拉取時間間隔5s scrape_interval: 5s static_configs: - targets: ['localhost:9090']
6、啟動服務
./prometheus --config.file=prometheus.yml
[](javascript:void(0)