美文网首页
2018-09-05 Telegraf 采集 + InfluxD

2018-09-05 Telegraf 采集 + InfluxD

作者: PSY的简书 | 来源:发表于2018-09-05 16:44 被阅读0次

Telegraf 数据采集

参考(https://www.cnblogs.com/liugh/p/6683488.html

  1. Telegraf下载
    官网无需翻墙,下载跳出的界面需要翻墙,链接
    https://dl.influxdata.com/telegraf/releases/telegraf-1.7.4_windows_amd64.zip

  2. telegraf 配置安装
    2.1 配置url http://localhost:8086
    2.2 设置database telegraf
    2.3 设置用户名、密码 admin/admin
    2.4 【可选】 配置 telegraf.log 地址 logfile

 ## Specify the log file name. The empty string means to log to stdout.
  logfile = "D:/telegraf/telegraf.log"

  ## Override default hostname, if empty use os.Hostname()
  hostname = ""

###############################################################################
#                                  OUTPUTS                                    #
###############################################################################
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
  # The full HTTP or UDP endpoint URL for your InfluxDB instance.
  # Multiple urls can be specified but it is assumed that they are part of the same
  # cluster, this means that only ONE of the urls will be written to each interval.
  # urls = ["udp://127.0.0.1:8089"] # UDP endpoint example
  urls = ["http://localhost:8086"] # required
  # The target database for metrics (telegraf will create it if not exists)
  database = "telegraf" # required
  # Precision of writes, valid values are "ns", "us" (or "µs"), "ms", "s", "m", "h".
  # note: using second precision greatly helps InfluxDB compression
  precision = "s"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "5s"
  username = "admin"
  password = "admin"
  # Set the user agent for HTTP POSTs (can be useful for log differentiation)
  # user_agent = "telegraf"
  # Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  # udp_payload = 512

InfluxDB存储

参考(https://www.jianshu.com/p/f59fea803879)\


Grafana显示

参考(http://docs.grafana.org/features/datasources/influxdb/

  1. Grafana下载
    下载地址:https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.3.windows-amd64.zip
    安装指南:http://docs.grafana.org/installation/windows/

  2. 启动
    2.1 influxdb
    通过cmd命令窗口,切换到influxdb安装目录,执行如下命令:influxd -config influxdb.conf
    2.2 Telegraf
    通过cmd命令窗口,切换到Telegraf安装目录,执行如下命令:telegraf -config telegraf.conf
    2.3 Grafana
    切换到Grafana安装目录中的bin目录下,双击grafana-server.exe启动程序

  3. 使用 参考
    访问 http://localhost:3000,使用admin/admin登录本机Grafana,新建influxdb数据源:
    3.1 选择Data Sources

    选择Data Sources

3.2 点击 [Add data source]


Add data source

3.3 设置数据源相关字段


设置数据库

3.4 点击add即可添加完成

3.5 Grafana添加数据图表


添加Dashboards

3.6 选择视图样式


选择视图样式

3.7 进入编辑模式


点击Edit

3.8 对视图进行编辑


视图编辑

具体操作说明(http://docs.grafana.org/features/panels/graph/

3.9 保存Dashboard


保存 配置示例

参考链接

  1. https://www.cnblogs.com/kingleft/p/7692415.html
  2. https://www.jianshu.com/p/fe11d681bd58?tdsourcetag=s_pcqq_aiomsg
  3. https://www.linuxdaxue.com/influxdb-query-data-by-http-api.html
  4. https://www.cnblogs.com/liugh/p/6683488.html
  5. https://github.com/jasper-zhang/influxdb-document-cn/blob/master/Query_language/data_exploration.md

`

相关文章

网友评论

      本文标题:2018-09-05 Telegraf 采集 + InfluxD

      本文链接:https://www.haomeiwen.com/subject/mmbawftx.html