Channel Version Revision Published Runs on
latest/stable 44 44 27 Jan 2022
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
latest/candidate 44 44 11 Oct 2021
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
juju deploy telegraf
Show information
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.


20.04 18.04 16.04


The plugin-driven server agent for collecting & reporting metrics. Read more

Relevant links

Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion


This is a subordinate charm to deploy the telegraf metrics agent to collect metrics from related services. The metrics may be scraped by or pushed to supported systems such as Prometheus, Graphite or InfluxDB.

For details about telegraf see:


Deploy telegraf alongside your service, and also a time series storage (in this case, influxdb)

juju deploy telegraf
juju deploy influxdb
juju deploy some-service

Add the relations:

juju add-relation telegraf:juju-info some-service:juju-info
juju add-relation telegraf:influxdb-api influxdb:api

Network space support

The charm support the 'prometheus-client' binding for the prometheus-client interface. If the charm is deployed with 'prometheus-client' bound to a network space then the client relation will contain the network space IP address rather than the unit's private address.

Note for deployment into LXC containers

When deployed into a container, the following plugins are disabled:

  • cpu, disk, diskio, mem, swap, system, bcache, bond, cgroup, kernel_vmstat

On very busy environments with lots of LXC containers per host, some metrics collected by default may contribute to performance issues with lxcfs. In order to reduce this, you may wish to consider disabling the following plugins:

  • net, netstat, conntrack, nstat


Installation method: deb or snap

The charm can deploy using either a deb (default) or a snap installation. juju config telegraf install_method=deb # to use the debian package juju config telegraf install_method=snap # to use the snap Only the needed package (deb or snap) will be installed.

To change the snap channel: juju config telegraf snap_channel=beta

Prometheus Output

By default, Prometheus output is presented available for scraping.

InfluxDB Output

When related to an InfluxDB service, metrics will be pushed to a database named telegraf.

Apache Input

For the apache input plugin, the charm provides the apache relation which uses apache-website interface. Current apache charm disables mod_status and in order to telegraf apache input to work status should be removed from the list of disable_modules in the apache charm config.

Postgresql & MySQL input

Due to relation scope issues, two relations need to be established between telegraf and the postgresql service. first a plain juju-info relation to get standard system metrics and a db-admin relation for PostgreSQL database metrics. eg.:

juju add-relation postgresql:juju-info telegraf
juju add-relation postgresql:db-admin telegraf

Similarly, for MySQL:

juju add-relation mysql:juju-info telegraf
juju add-relation mysql:db-admin telegraf

Rabbitmq Input

You will need both relations:

  • juju add-relation telegraf:juju-info rabbitmq-server:juju-info to start serving data
  • juju add-relation telegraf:amqp rabbitmq-server:amqp for the actual rabbitmq communication

This relation requires rabbitmq management plugin to be activated: juju config rabbitmq-server management_plugin=true

The rabbitmq charm doesn't appear to give true administrator privileges to relations. On the rabbitmq unit, you will need to grant permissions for the newly created charm user: rabbitmqctl set_permissions -p openstack telegraf-telegraf-XX ".*" ".*" ".*"

The charm configures telegraf to drop idle_since metrics (e.g. idle_since="2018-08-14 0:24:04") which break time series in Prometheus, since any difference in labels (presence or lack, and content) is treated as a new series.



A basic set of input plugins are setup by default, which can be overriden with the inputs_config configuration option. Both of these accept raw telegraf configuration.

To configure any of the (default or via relation) plugins, the extra_options charm config can be used. It's yaml, that needs to be encoded as a string in the config. For example:

# The trailing | means the following indented section is all one string.
extra_options: |
            percpu: false
            fielddrop: ["time_*"]
            mount_points: ["/"]
            ignore_fs: ["tmpfs", "devtmpfs"]
            local: false
            cluster_health: true
            databases: ["foo", "bar"]
                db: ["template", "postgres"]
            precision: ms

This extra options will only be applied to plugins configured via relations and the following list (defined in templates/base_inputs.conf):

- inputs.cpu
- inputs.disk
- inputs.diskio
- inputs.mem
- inputs.netstat
- inputs.swap
- inputs.system

The only output plugin supported via relation is influxdb, any other output plugin needs to be configured manually (via juju config).

To use a different metrics storage such as Graphite, the raw telegraf plugin configuration needs to be set as a string in outputs_config configuration. For example:

  # The trailing | indicates a multiline string in yaml.
  outputs_config: |
    servers = [""]
    prefix = "juju_local.devel.telegraf"
    timeout = 10

This will make telegraf agents to send the metrics to the graphite instance.

Contact Information