Error in helm chart "cannot unmarshal TOML integer into float64"

12/23/2019

I was trying to install the Telegraf helm chart to a kubernetes cluster in namespace internet-monitor.

I want to integrate InfluxDB, Telegraf, and Grafana for internet connection monitoring.

Grafana dashboard that I want to integrate is: https://grafana.com/grafana/dashboards/2690

It says that the Telegraf input ping plugin should have configuration:

[[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

I installed the Telegraph chart with values file:

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"

But when installing the helm chart, it gives error:

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

As specified here, PingInterval needs a float64 value.

How can I solve this?

-- AnjanaDyna
kubernetes-helm
telegraf
toml
yaml

2 Answers

3/5/2020

This happened when the telegraf configuration in the values file specified the ping_interval float values like:

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

The workaround for this parsing problem is to specify these two parameters( whose values are of float type) as arguments for the ping command.

telegraf: 
  config:
    inputs:
      - ping:
          arguments: ["-i", "1.0", "-W", "2.0"]
-- AnjanaDyna
Source: StackOverflow

12/23/2019

From Telegraf Ping Input Plugin README.md

  ## Time to wait between sending ping packets in seconds.  Operates like the
  ## "-i" option of the ping command.
  # ping_interval = 1.0

Try setting it as YAML float:

ping_interval: "1.0" or ping_interval: !!float 1

-- edbighead
Source: StackOverflow