influxdb 全家桶运行

时间:2022-01-27 15:11:32

一个简单的demo,集成了telegraf,influxdb,chronograf,kapacitor,nginx,一张来自官方的参考图

组件集成图

influxdb 全家桶运行

环境准备

使用docker-compose

  • docker-compose 文件
version: "3"
services:
    nginx:
      image: nginx
      ports:
      - "8080:8080"
      volumes: 
      - "./index.html:/usr/share/nginx/html/index.html"
      - "./nginx.conf:/etc/nginx/nginx.conf"
    timescaledb:
      image: timescale/timescaledb-postgis:latest-pg10
      ports:
      - "5432:5432"
      environment:
      - "POSTGRES_PASSWORD=dalong"
    influxdb:
      image: influxdb
      ports: 
      - "8086:8086"
    telegraf:
      image: telegraf
      volumes: 
      - "./telegraf.conf:/etc/telegraf/telegraf.conf"
    chronograf:
      image: chronograf
      ports:
      - "8888:8888"
      command: --influxdb-url=http://influxdb:8086
    kapacitor:
      image: kapacitor
      environment:
      - "KAPACITOR_INFLUXDB_0_URLS_0=http://influxdb:8086"
      ports:
      - "9092:9092"
 
 
  • telegraf 配置

    主要添加了nginx input 以及配置了influxdb 信息 telegraf.conf

[[outputs.influxdb]]
  urls = ["http://influxdb:8086"]
[[inputs.nginx]]
  # An array of Nginx stub_status URI to gather stats.
  urls = ["http://nginx:8080/ngx_status"]
 
 

运行&&效果

  • 启动
docker-compose up -d
 
  • 效果

influxdb 全家桶运行
influxdb 全家桶运行

参考资料

https://github.com/rongfengliang/outflux-influxdb-demo
https://www.influxdata.com/