Prometheus(一)之基礎(chǔ)安裝

一、準(zhǔn)備條件
Windows10
go1.15.1.windows-amd64
二、下載與安裝
1、下載
Download | Prometheus,依據(jù)需求選擇對(duì)應(yīng)版本的包,此處選擇 Windows 對(duì)應(yīng)版本 amd64

2、解壓文件
解壓到目標(biāo)安裝目錄,此處為D:\ProgramData\prometheus-2.23.0-rc,解壓之后,目錄結(jié)構(gòu)如下:
consoles
console_libraries
11,357 LICENSE
3,420 NOTICE
89,340,928 prometheus.exe
926 prometheus.yml
79,250,432 promtool.exe 3、修改配置
解壓路徑中的配置文件為prometheus.yml,系統(tǒng)默認(rèn)的數(shù)據(jù)存儲(chǔ)方式為文件形式,存儲(chǔ)在與執(zhí)行程序prometheus.exe同目錄下的data文件夾中,可以通過(guò)指令--storage.tsdb.path="data/"進(jìn)行數(shù)據(jù)存儲(chǔ)路徑的設(shè)置。
# my global config
global:
scrape_interval: 15s?# Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval:?15s?# Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
-?static_configs:
-?targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=` to any timeseries scraped from this config.
-?job_name:?'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
-?targets: ['localhost:9090']4、運(yùn)行訪問(wèn)
在 cmd 中啟動(dòng) prometheus.exe ,可看到如下輸出:
level=info ts=2020-11-26T10:36:59.027Z caller=head.go:722 component=tsdb msg="WAL replay completed" checkpoint_replay_duration=0s wal_replay_duration=996.2μs total_replay_duration=1.9937ms
level=info ts=2020-11-26T10:36:59.028Z caller=main.go:742 fs_type=unknown
level=info ts=2020-11-26T10:36:59.028Z caller=main.go:745 msg="TSDB started"
level=info ts=2020-11-26T10:36:59.028Z caller=main.go:871 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2020-11-26T10:36:59.040Z caller=main.go:902 msg="Completed loading of configuration file" filename=prometheus.yml totalDuration=11.9662ms remote_storage=0s web_handler=0s query_engine=0s scrape=10.969ms scrape_sd=0s notify=0s notify_sd=0s rules=0s
level=info ts=2020-11-26T10:36:59.040Z caller=main.go:694 msg="Server is ready to receive web requests."執(zhí)行成功后訪問(wèn)http://localhost:9090/能夠出現(xiàn)對(duì)應(yīng)頁(yè)面,則表示訪問(wèn)成功。

往期推薦
評(píng)論
圖片
表情

