Prometheus安裝配置

學海無涯519發表於2020-11-09

一、什麼是Prometheus?

  官方介紹:Prometheus受啟發於Google的Brogmon監控系統(相似的Kubernetes是從Google的Brog系統演變而來),從2012年開始由前Google工程師在Soundcloud以開源軟體的形式進行研發,並且於2015年早期對外發布早期版本。2016年5月繼Kubernetes之後成為第二個正式加入CNCF基金會的專案,同年6月正式釋出1.0版本。2017年底釋出了基於全新儲存層的2.0版本,能更好地與容器平臺、雲平臺配合。

二、怎麼安裝Prometheus?

1.下載prometheus安裝包(linux版)到 /opt/minitor/prometheus 。
        
 
2.執行 tar -zxvf prometheus-2.0.0.linux-amd64.tar.gz ,解壓檔案到當前目錄。
 
3.執行 vim /opt/minitor/prometheus/prometheus.yml。
# my global config
global:
  scrape_interval:     5s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 5s # 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: ['localhost:9093']
 
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "/opt/prometheus/prome/prometheus-2.0.0.linux-amd64/rules/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=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
 
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
 
    static_configs:
      - targets: ['ip:9090']
        labels:
          instance: prometheus

 

4.啟動prometheus。
nohup ./prometheus --config.file=prometheus.yml --web.listen-address=:9090 &

 

5.去prometheus自帶的web頁面上檢視

 

 

6.prometheus狀態為up,說明配置成功。

相關文章