0

我试图将Telegraf helm chart 安装到命名空间 internet-monitor 中的 kubernetes 集群。

我想集成 InfluxDB、Telegraf 和 Grafana 来监控互联网连接。

我要集成的 Grafana 仪表板是:https ://grafana.com/grafana/dashboards/2690

它说 Telegraf 输入 ping 插件应该有配置:

[[inputs.ping]]
interval = "60s"
urls = ["208.67.222.222", "208.67.220.220", "ddg.gg", "pfSense.home", "accessPoint.home", "amazon.com", "github.com"]
count = 4
ping_interval = 1.0
timeout = 2.0

我安装了带有值文件的电报图表:

config:
  agent:
    interval: "10s"
    round_interval: true
    metric_batch_size: 1000
    metric_buffer_limit: 10000
    collection_jitter: "0s"
    flush_interval: "10s"
    flush_jitter: "0s"
    precision: ""
    debug: false
    quiet: false
    logfile: ""
    hostname: "$HOSTNAME"
    omit_hostname: false
  processors:
    - enum:
        mapping:
          field: "status"
          dest: "status_code"
          value_mappings:
            healthy: 1
            problem: 2
            critical: 3
  outputs:
    - health:
        service_address: "http://:8888"
        compares:
          field: buffer_size
          lt: 5000.0
        contains:
          field: buffer_size
    - influxdb:
        urls:
          - "http://influxdb.internet-monitor.svc.cluster.local:8086"
        database: "telegraf"
  inputs:
    - statsd:
        service_address: ":8125"
        percentiles:
          - 50
          - 95
          - 99
        metric_separator: "_"
        allowed_pending_messages: 10000
        percentile_limit: 1000
    - ping:
        interval: "60s"
        count: 4
        ping_interval: 1
        timeout: 2
        urls:
          - "208.67.222.222"
          - "amazon.com"
          - "github.com"
          - "google.com"
          - "10.0.2.46"
          - "192.168.1.223"
          - "192.168.1.20"

但是在安装 helm chart 时,它会给出错误:

2019-12-23T11:06:25Z I! Starting Telegraf 1.12.6
2019-12-23T11:06:25Z I! Using config file: /etc/telegraf/telegraf.conf
2019-12-23T11:06:25Z E! [telegraf] Error running agent: Error parsing /etc/telegraf/telegraf.conf, line 46: (ping.Ping.PingInterval) cannot unmarshal TOML integer into float64

如此处所指定, PingInterval需要一个 float64 值。

我该如何解决这个问题?

4

1 回答 1

0

当值文件中的电报配置指定 ping_interval 浮点值时,就会发生这种情况:

telegraf: 
  config:
    inputs:
      - ping:
          ping_interval: "1.0"
          timeout: "2.0"

此解析问题的解决方法是将这两个参数(其值为浮点类型)指定为 ping 命令的参数。

telegraf: 
  config:
    inputs:
      - ping:
          arguments: ["-i", "1.0", "-W", "2.0"]
于 2020-03-05T05:12:55.333 回答