• influxdb1.8自身参数监控方案探索


    1. 部署chronograf

    chronograf:
      image: chronograf
      ports:
      - 8888:8888
      environment:
      - INFLUXDB_URL=http://influxdb:8086
      volumes:
      - ./chronograf:/var/lib/chronograf
    

    注意添加环境变量 INFLUXDB_URL=http://influxdb:8086, 这样在访问web页面时,可以设置url为http://influxdb:8086,否则默认的http://localhost:8086会连接失败

    2. 部署telegraf

    telegraf:
      container_name: telegraf
      image: telegraf
      restart: always
      volumes:
      - /data/elements/config/telegraf.conf:/etc/telegraf/telegraf.conf:ro
      environment:
      - INFLUXDB_URL=http://influxdb:8086
    

    生成telegraf.conf

    docker run --rm telegraf telegraf config > ./telegraf.conf
    

    配置telegraf.conf

    [[outputs.influxdb]]
      urls = ["http://influxdb:8086"]
      database = "telegraf" #需要在influxdb中手动新建telegraf库
      retention_policy = ""
      write_consistency = "any"
      timeout = "5s"
      
      # HTTP Basic Auth
      username = "admin"
      password = "1qaz2wsx"
      
    #下面的配置不确定是否需要
    [[inputs.influxdb]]
      urls = [
        "http://influxdb:8086/debug/vars"
      ]
      timeout = "5s"
    

    3. 部署kapacitor

      kapacitor:
        container_name: kapacitor
        image: kapacitor
        ports:
        - 9093:9092  #原先已部署kafka占用了9092
        restart: always
        volumes:
        - /data/elements/config/kapacitor.conf:/etc/kapacitor/kapacitor.conf:ro
        environment:
        - INFLUXDB_URL=http://influxdb:8086
    

    生成配置文件

    docker run --rm kapacitor kapacitord config > ./kapacitor.conf
    

    修改配置文件

    hostname = "9c14c3d07097" #docker-compose中新建kapacitor后,修改容器名字
    [[influxdb]]
      urls = ["http://influxdb:8086"]
      username = "admin"
      password = "1qaz2wsx"
    

    在chronograf页面的配置选项中,新建一个kapacitor的url为http://kapacitor:9092/

    4. API获取一些指标

    http://52.81.242.154:8086/debug/vars
    http://52.81.242.154:9093/kapacitor/v1/debug/vars

    API查询操作
    https://blog.csdn.net/yue530tomtom/article/details/82686695

    http访问查询

    http://52.81.242.154:8086/query?db=telegraf&u=admin&p=1qaz2wsx&q=select * from cpu limit 10
    

    curl访问查询

    curl -G 'http://localhost:8086/query?db=telegraf&u=admin&p=1qaz2wsx&pretty=true' --data-urlencode 'q=SELECT * FROM "cpu" limit 10'
    -G: 以get方式发送数据,默认就是get
    "cpu"中的引号不要也行,用途是有特殊字符比如_需要用双引号包起来
    

    数据库中 内部库 _internal各表说明

    https://docs.influxdata.com/platform/monitoring/influxdata-platform/tools/measurements-internal/#queryfail

  • 相关阅读:
    更多的bash命令
    简单的Writer和Reader
    矩阵的基本知识
    在Java中如何实现“Pless presss any key to continue.”
    递归思想解决输出目录下的全部文件
    初学File类
    如何避免遭受HTTS中间人攻击
    中间人攻击破解HTTPS传输内容
    LINE最新版6.5.0在iOS上的删除信息取证
    JB for iOS 9.3
  • 原文地址:https://www.cnblogs.com/regit/p/16802462.html
Copyright © 2020-2023  润新知