kubernetes
elasticsearch
kafka
zookeeper
ceph
cassandra
percona-cluster
glance
mariadb
spark
Telegraf is an agent written in Go for collecting metrics from the system it's running on, or from other services, and writing them into InfluxDB or other outputs. Design goals are to have a minimal memory footprint with a plugin system so that developers in the community can easily add support for collecting metrics from well known services (like Hadoop, Postgres, or Redis) and third party APIs (like Mailchimp, AWS CloudWatch, or Google Analytics). New input and output plugins are designed to be easy to contribute, we'll eagerly accept pull requests and will manage the set of plugins that Telegraf supports. See the contributing guide for instructions on writing new plugins.
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: https://github.com/influxdata/telegraf
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
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.
By default, Prometheus output is presented available for scraping.
When related to an InfluxDB service, metrics will be pushed to a database named telegraf.
telegraf
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.
apache-website
mod_status
status
disable_modules
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-info
db-admin
``` 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 ```
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
juju add-relation telegraf:juju-info rabbitmq-server:juju-info
juju add-relation telegraf:amqp rabbitmq-server:amqp
This relation requires rabbitmq management plugin to be activated: juju set rabbitmq-server management_plugin=true
juju set 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 ".*" ".*" ".*"
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.
idle_since
idle_since="2018-08-14 0:24:04"
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.
inputs_config
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:
extra_options
```yaml telegraf: # The trailing | means the following indented section is all one string. extra_options: | inputs: cpu: percpu: false fielddrop: ["time_*"] disk: mount_points: ["/"] ignore_fs: ["tmpfs", "devtmpfs"] elasticsearch: local: false cluster_health: true postgresql: databases: ["foo", "bar"] tagpass: db: ["template", "postgres"] outputs: influxdb: 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.net - inputs.netstat - inputs.swap - inputs.system
templates/base_inputs.conf
The only output plugin supported via relation is influxdb, any other output plugin needs to be configured manually (via juju set).
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:
outputs_config
```yaml telegraf: # The trailing | indicates a multiline string in yaml. outputs_config: | [[outputs.graphite]] servers = ["10.0.3.231:2003"] prefix = "juju_local.devel.telegraf" timeout = 10 ```
This will make telegraf agents to send the metrics to the graphite instance.