telegraf-agent + onput:prometheus+ opentsdb在telegraf中配置介绍


一. telgraf
Telegraf参数配置:

1. interval:            所有输入的默认数据收集间隔

2. round_interval:      将收集间隔舍入为“interval”例如,如果interval =“10s”则始终收集于:00,:10,:20等。

3. metric_batch_size:   Telegraf将指标发送到大多数metric_batch_size指标的批量输出。

4. metric_buffer_limit: Telegraf将缓存metric_buffer_limit每个输出的指标,并在成功写入时刷新此缓冲区。这应该是倍数
                         metric_batch_size不能少于2倍metric_batch_size。

5. collection_jitter:   集合抖动用于随机抖动集合。每个插件在收集之前将在抖动内随机休眠一段时间。这可以用来避免许多插件同时
                         查询sysfs之类的东西,这会对系统产生可测量的影响。



6. flush_interval:         所有输出的默认数据刷新间隔。您不应将此设置为以下间隔。
                         最大值flush_interval为flush_interval+flush_jitter

7. flush_jitter:           将刷新间隔抖动一个随机量。这主要是为了避免运行大量Telegraf实例的用户出现大量写入峰值。
                         例如,flush_jitter: 5s和flush_interval: 10s之一意味着每10-15秒就会发生一次冲洗。

8. precision:              默认情况下,precision将设置为与收集时间间隔相同的时间戳顺序,最大值为1s。精度不会用于服务输入,
                         例如logparser和statsd。有效值为 ns,us(或µs)ms,和s。

9. logfile:                指定日志文件名。空字符串表示要登录stderr。

10. debug:                  在调试模式下运行Telegraf。

11. quiet:                  以安静模式运行Telegraf(仅限错误消息)。

12. hostname:               覆盖默认主机名,如果为空使用os.Hostname()。

13. omit_hostname:          如果为true,则不host在Telegraf代理中设置标记。

----------------------------------------------------------------------------

[agent]
## 数据收集周期
interval = "10s"
## 如果 interval="10s" :00, :10, :20 依次进行收集
round_interval = true
## 输出大小
metric_batch_size = 1000
## 缓存大小
metric_buffer_limit = 10000
## 接收插件休眠周期
collection_jitter = "0s"
## 数据flush周期
flush_interval = "10s"
## 发送插件休眠周期
flush_jitter = "0s"
## 支持的时间单位 "ns", "us" (or "µs"), "ms", "s".
precision = ""
## 调试模式
debug = false
## 静默模式
quiet = false
## 日志路径
logfile = ""
## 主机名,默认 os.Hostname()
hostname = ""
## 如果设置为true,tag中将没有host信息
omit_hostname = false

--------------------------------------------------------------------
二. prometheus

# Configuration for the Prometheus client to spawn
[[outputs.prometheus_client]]
  ## Address to listen on.
  listen = ":9273"
  ## Metric version controls the mapping from Prometheus metrics into Telegraf metrics.
  ## See "Metric Format Configuration" in plugins/inputs/prometheus/README.md for details.
  ## Valid options: 1, 2
  # metric_version = 1

  ## Use HTTP Basic Authentication.
  使用 HTTP 基本身份验证。
  # basic_username = "Foo"
  # basic_password = "Bar"

  ## If set, the IP Ranges which are allowed to access metrics.
  ##   ex: ip_range = ["192.168.0.0/24", "192.168.1.0/30"]
  如果设置,则为允许访问指标的 IP 范围。
  # ip_range = []

  ## Path to publish the metrics on.
  发布指标的路径。
  # path = "/metrics"

  ## Expiration interval for each metric. 0 == no expiration
  每个指标的过期间隔。0 == 无过期
  # expiration_interval = "60s"

  ## Collectors to enable, valid entries are "gocollector" and "process".
  ## If unset, both are enabled.
  # collectors_exclude = ["gocollector", "process"]

  ## Send string metrics as Prometheus labels.
  ## Unless set to false all string metrics will be sent as labels.
  以 Prometheus 标签的形式发送字符串指标。
  除非设置为 false,否则所有字符串指标都将作为标签发送。
  # string_as_label = true

  ## If set, enable TLS with the given certificate.
  如果设置,请使用给定的证书启用 TLS。
  # tls_cert = "/etc/ssl/telegraf.crt"
  # tls_key = "/etc/ssl/telegraf.key"

  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections
  将一个或多个允许的客户端 CA 证书文件名设置为
  启用相互身份验证的 TLS 连接
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]

  ## Export metric collection time.
  导出指标收集时间。
  # export_timestamp = false


  三. opentsdb

  # Configuration for OpenTSDB server to send metrics to
[[outputs.opentsdb]]
  ## prefix for metrics keys
  指标键的前缀
  prefix = "my.specific.prefix."

  ## DNS name of the OpenTSDB server
  ## Using "opentsdb.example.com" or "tcp://opentsdb.example.com" will use the
  ## telnet API. "http://opentsdb.example.com" will use the Http API.
  host = "opentsdb.example.com"

  ## Port of the OpenTSDB server
  port = 4242

  ## Number of data points to send to OpenTSDB in Http requests.
  ## Not used with telnet API.
  在 Http 请求中发送到 OpenTSDB 的数据点数。
  不与 telnet API 一起使用。
  http_batch_size = 50

  ## URI Path for Http requests to OpenTSDB.
  ## Used in cases where OpenTSDB is located behind a reverse proxy.
  用于对 OpenTSDB 的 Http 请求的 URI 路径。
  用于 OpenTSDB 位于反向代理后面的情况。
  http_path = "/api/put"

  ## Debug true - Prints OpenTSDB communication
  debug = false

  ## Separator separates measurement name from field
  分隔符将测量名称与字段分开
  separator = "_"

posted @ 2022-07-06 19:17  GEGEWU-  阅读(252)  评论(0编辑  收藏  举报