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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容