Telegraf 数据采集
参考(https://www.cnblogs.com/liugh/p/6683488.html)
Telegraf下载
官网无需翻墙,下载跳出的界面需要翻墙,链接
https://dl.influxdata.com/telegraf/releases/telegraf-1.7.4_windows_amd64.zip
telegraf 配置安装
2.1 配置urlhttp://localhost:8086
2.2 设置databasetelegraf
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/)
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.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启动程序-
使用 参考
访问 http://localhost:3000,使用admin/admin登录本机Grafana,新建influxdb数据源:
3.1 选择Data Sources
3.2 点击 [Add data source]
3.3 设置数据源相关字段
3.4 点击add即可添加完成
3.5 Grafana添加数据图表
3.6 选择视图样式
3.7 进入编辑模式
3.8 对视图进行编辑
具体操作说明(http://docs.grafana.org/features/panels/graph/)
3.9 保存Dashboard
参考链接
- https://www.cnblogs.com/kingleft/p/7692415.html
- https://www.jianshu.com/p/fe11d681bd58?tdsourcetag=s_pcqq_aiomsg
- https://www.linuxdaxue.com/influxdb-query-data-by-http-api.html
- https://www.cnblogs.com/liugh/p/6683488.html
- https://github.com/jasper-zhang/influxdb-document-cn/blob/master/Query_language/data_exploration.md
`