influxdb + grafana 采用 docker 部署

获取 influxdb、grafana 镜像

docker pull influxdb;
docker pull grafana/grafana;

docker-compose 文件

➜  monitor cat influxdb/docker-compose.yml
version: "2"
services:
  influxdb:
    image: influxdb
    ports:
      - 8086:8086
      - 2003:2003
    environment:
      - INFLUXDB_GRAPHITE_ENABLED=true
➜  monitor cat grafana/docker-compose.yml
version: "2"
services:
  influxdb:
    image: grafana/grafana
    ports:
      - 3000:3000
    environment:
      - GF_SERVER_ROOT_UR=http://127.0.0.1
      - GF_SECURITY_ADMIN_PASSWORD=passwd

首先启动 influxdb

docker-compose -f monitor/influxdb/docker-compose.yml up -d

进入容器中修改 influxdb.conf

docker exec -it 76c3ae242d99 bash
#因基础镜像没有vi及vim,所以需要使用apt-get安装vim,在执行apt-get时可能需要***。。或者换个国内的源
apt-get update
apt-get install -y vim
#为/etc/influxdb/influxdb.conf添加配置
[[graphite]]
        enabled = true
        database = "gatlingdb"

        templates = [
                "gatling.*.*.*.* measurement.simulation.request.status.field",
                "gatling.*.users.*.* measurement.simulation.measurement.request.field"
        ]

修改 gatling.conf

启动 grafana

docker-compose -f monitor/grafana/docker-compose.yml up -d

访问 grafana:http://localhost:3000
添加 influxdb 数据源

导入模板(https://github.com/gatling/gatling/blob/master/src/sphinx/realtime_monitoring/code/gatling.json

导入成功后

测试时实时查看数据

官方资料:http://gatling.io/docs/current/realtime_monitoring/


↙↙↙阅读原文可查看相关链接,并与作者交流