jmeter+grafana+prometheus的docker性能压测体系

好记性不如烂笔头,记下来便人便己:

1、搭建Prometheus的容器:

docker run -d --name prometheus -p 9090:9090 --network grafana -v $PWD/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

其中:

①prometheus.yml文件的默认配置可以从容器中挂载出来一份,也可以直接修改。我要访问的的服务在本机。这里有个坑,就是在容器里面要访问宿主机的ip的话,不能写localhost。方法是:要么将容器共享宿主机网络,这个不建议;要么就直接写宿主机的内网ip即可。

复制代码
# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # 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:
      # - 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']

  - job_name: 'python-modules'

    static_configs:
    - targets: ['ip:80']
复制代码

②创建一个grafana共享网络,使之与grafana容器处于同一网络空间

 

2、启动grafana容器

docker run -d --name grafana --network grafana -p 3000:3000 grafana/grafana:6.6.2

 

3、 在grafana里面配置好Prometheus的数据源,即dashboard即可。完成后的样例如下:

 

posted on   101欢欢鱼  阅读(1045)  评论(1编辑  收藏  举报

编辑推荐:
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示