Prometheus部署与实战

一、Prometheus部署
cd /opt
wget https://github.com/prometheus/prometheus/releases/download/v2.8.1/prometheus-2.8.1.linux-amd64.tar.gz
备注:其他版本请到官方下载https://prometheus.io/download/
tar zxf prometheus-2.8.1.linux-amd64.tar.gz
mv prometheus-2.8.1.linux-amd64 prometheus
mv /opt/prometheus/prometheus.yml /opt/prometheus/prometheus.yml.bak
vim /opt/prometheus/prometheus.yml
添加配置
global:
scrape_interval: 15s # 抓取时间,默认60s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
#服务注册与发现
- job_name: 'consul-prometheus'
consul_sd_configs:
#consul 地址
- server: 'consul:8500'
services: []

  启动服务:
  /opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml &
  验证:可在浏览器上访问:localhost:9090

转载于:https://www.jianshu.com/p/666eab46d84d

猜你喜欢

转载自blog.csdn.net/weixin_33743661/article/details/91072186