imooc 使用Prometheus实践基于Spring Boot监控告警体系 笔记

https://www.imooc.com/coursescore/1231

安装prom

启动

 ./prometheus --config.file=prometheus.yml

 

 启动,并可以通过web动态更新配置

./prometheus --config.file=prometheus.yml --web.enable-lifecycle

动态更新配置

curl -X POST http://localhost:9090/-/reload

 

访问:

http://192.168.219.129:9090/graph

和metrics页面

http://192.168.219.129:9090/metrics

 

 

cat prometheus.yml

# my global config
global:
  scrape_interval:     15s # 抓取间隔
  evaluation_interval: 15s # 计算间隔
  # 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=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']

 

grafana安装:

https://grafana.com/grafana/download

 

posted @ 2020-10-26 13:19  alexhe  阅读(161)  评论(0编辑  收藏  举报