Telegraf k8s docs - configuration management

Default configuration

By default, the charm will have telegraf run with a very basic, minimalist configuration:

[global_tags]
[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 = ""
  omit_hostname = false
[[inputs.internal]]
  collect_memstats = true
[[outputs.prometheus_client]]
  listen = ":9103"

Manually updating the telegraf configuration

The telegraf configuration can be updated by injecting raw configuration snippets into juju. For instance, to define the input plugins:

$ juju config telegraf inputs = '[[inputs.internal]]
  collect_memstats = true
[[inputs.github]]
  repositories = ["influxdata/telegraf"]'

This can be tedious to run in a CLI. A better way is to write the inputs config into e.g. inputs.conf, and use it directly with the juju command:

juju config telegraf inputs=@inputs.conf

The same applies to global tags and aggregators.

Updating the telegraf configuration with relations

Telegraf can be related to other charms thanks to relation.
For instance, the postgresql input plugin will be configured when telegraf joins a pg relation:

$ juju relate telegraf:pg postgresql:db