• 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即可。完成后的样例如下:

  • 相关阅读:
    指定盘符获取u盘PID、VID、序列号等信息
    禁用u盘再启用
    golang 使用编译选项-H=windowsgui后,仍然输出log到console
    c#实现"扫描检测硬件改动"
    哈希表
    Python 环境搭建
    Python 简介
    Python 基础教程
    7.1.2 定义改进的Sales_date类
    第七章 类
  • 原文地址:https://www.cnblogs.com/fish-101/p/14007478.html
Copyright © 2020-2023  润新知