Prometheus服務搭建(非容器)

github:https://github.com/prometheus

Prometheus安裝

1)下載安裝

線上統一版本爲 2.12.0,下載地址:

https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz

啓動方式,不要默認啓動

–config.file=“prometheus.yml” #啓動的配置文件
–web.listen-address=“0.0.0.0:9090” #監聽的地址端口
–web.max-connections=512 #最大連接數
–storage.tsdb.path="/data/prometheus" #本地存儲的位置
–storage.tsdb.retention.time=15d #數據在本地存儲的時間
–storage.tsdb.no-lockfile #不允許在數據目錄裏面創建鎖文件
–query.timeout=2m #查詢超時時間
–query.max-concurrency=20 #同時查詢的併發數

啓動命令
nohup prometheus --config.file=prometheus.yml --storage.tsdb.path=/data/prometheus --web.listen-address=“0.0.0.0:9090” --web.max-connections=512 --storage.tsdb.retention.time=15d --query.timeout=2m --query.max-concurrency=20 &

2)默認訪問 http://localhost:9090/

2.文件變更後的熱更新方式(prometheus.yml和rules文件變更後默認不會自動更新)

#方式1:找到Prometheus的進程ID,然後執行
kill -HUP pid
#方式2:開啓配置文件熱加載,Prometheus啓動時在參數中加入–web.enable-lifecycle(該參數默認關閉),
./prometheus --web.enable-lifecycle
#然後執行curl命令刷新配置
curl -X POST http://IP:port/-/reload

AlertManager安裝

1)下載安裝
https://github.com/prometheus/alertmanager/releases/download/v0.18.0/alertmanager-0.18.0.linux-amd64.tar.gz

2)默認訪問 http://localhost:9093/

Pushgateway安裝

1)下載安裝
https://github.com/prometheus/pushgateway/releases/download/v1.1.0/pushgateway-1.1.0.linux-amd64.tar.gz
2)默認訪問 http://localhost:9091/

NodeExporter安裝

1)下載安裝

https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz

2)默認訪問 http://localhost:9100/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章