Merge ~stub/charm-telegraf:tweaks into ~telegraf-charmers/charm-telegraf:master

Proposed by Stuart Bishop
Status: Merged
Approved by: Stuart Bishop
Approved revision: 46d236e9845841c7cb76eca0b65549b51d86a685
Merged at revision: 0bd067f683aad709e417a7d3cd12f9c32826bd53
Proposed branch: ~stub/charm-telegraf:tweaks
Merge into: ~telegraf-charmers/charm-telegraf:master
Prerequisite: ~stub/charm-telegraf:prometheus-by-default
Diff against target: 184 lines (+95/-46)
2 files modified
Makefile (+4/-2)
README.md (+91/-44)
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Stuart Bishop (community) Approve
Review via email: mp+302770@code.launchpad.net

This proposal supersedes a proposal from 2016-08-09.

Description of the change

Polish the README and tweak the makefile a bit.

Dependent on prometheus-by-default, as that is what this version of the docs says. Its a minor change if that isn't going to land.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote : Posted in a previous version of this proposal

+1

please see inline comment.

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote : Posted in a previous version of this proposal

The merge was fine but running tests failed.

review: Needs Fixing
Revision history for this message
Stuart Bishop (stub) wrote :

Previously approved

review: Approve
Revision history for this message
Guillermo Gonzalez (verterok) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 1ee0243..8fd218f 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -21,11 +21,13 @@ venv:
6 test: venv
7 venv/bin/py.test unit_tests/ -v
8
9-build: clean
10- @if test -z ${JUJU_REPOSITORY} || test -z ${INTERFACE_PATH} || test -z ${LAYER_PATH}; then echo "JUJU_REPOSITORY, LAYER_PATH and INTERFACE_PATH needs to be defined"; exit 1; fi
11+build: realclean
12 @charm build
13
14 clean:
15 @find -name __pycache__ | xargs rm -rf
16 @find -name *.pyc | xargs rm -rf
17 @rm -Rf venv
18+
19+realclean:
20+ git clean -fxd
21diff --git a/README.md b/README.md
22index 619041c..567b3e4 100644
23--- a/README.md
24+++ b/README.md
25@@ -1,6 +1,8 @@
26 # Overview
27
28-This is a subordinate charm to deploy telegraf metrics agent to collect metrics from all services deployed in the environment.
29+This is a subordinate charm to deploy the telegraf metrics agent to collect
30+metrics from related services. The metrics may be scraped by or pushed
31+to supported systems such as Prometheus, Graphite or InfluxDB.
32
33 For details about telegraf see: https://github.com/influxdata/telegraf
34
35@@ -20,61 +22,106 @@ Add the relations:
36
37 # Configuration
38
39-By default there is no output plugin configured, but a basic set of input plugins are setup, which can be overriden with inputs_config charm config.
40+## Prometheus Output
41
42-To configure any of the (default or via relation) plugins, the extra_options charm config can be used. It's string in yaml format, for example:
43+By default, Prometheus output is presented available for scraping.
44
45- inputs:
46- cpu:
47- percpu: false
48- fielddrop: ["time_*"]
49- disk:
50- mount_points: ["/"]
51- ignore_fs: ["tmpfs", "devtmpfs"]
52- elasticsearch:
53- local: false
54- cluster_health: true
55- postgresql:
56- databases: ["foo", "bar"]
57- tagpass:
58- db: ["template", "postgres"]
59- outputs:
60- influxdb:
61- precision: ms
62+## InfluxDB Output
63
64-This extra options will only be applied to plugins defined in templates/base_inputs.conf and any other plugins configured via relations.
65+When related to an InfluxDB service, metrics will be pushed to a database
66+named ``telegraf``.
67
68-## Apache input
69+## Apache Input
70
71-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.
72+For the apache input plugin, the charm provides the apache relation which
73+uses ``apache-website`` interface. Current apache charm disables
74+``mod_status`` and in order to telegraf apache input to work ``status``
75+should be removed from the list of ``disable_modules`` in the apache charm
76+config.
77
78 ## Postgresql input
79
80-Due to a [bug/regression](https://bugs.launchpad.net/postgresql-charm/+bug/1560262) in the new postgresql-charm in order to get actual postgresql metrics, two relations need to be established between telegraf and the postgresql service, first a plain juju-info relation to get telegraf setup and then a regular postgresql/db one. e.g:
81-
82-juju add-relation telegraf:juju-info postgresql:juju-info
83-juju add-relation telegraf:postgresql postgresql:db
84-
85-## Output
86-
87-The only output plugin supported via relation is influxdb, any other output plugin needs to be configured manually (via juju set)
88-
89-To use a different metrics storage, e.g: graphite. the plugin configuration needs to be set as a base64 string in outputs_config configuration.
90-
91-For exmaple, save the following config to a file:
92-
93- [[outputs.graphite]]
94- servers = ["10.0.3.231:2003"]
95- prefix = "juju_local.devel.telegraf"
96- timeout = 10
97-
98-And then
99-
100- juju set telegraf outputs_config="$(cat graphite-output.conf | base64)"
101+Due to [relation scope issues](https://bugs.launchpad.net/postgresql-charm/+bug/1560262), two relations need to be established between telegraf and the
102+postgresql service. first a plain ``juju-info`` relation to get standard
103+system metrics and a ``postgresql`` relation for PostgreSQL database metrics.
104+eg.:
105+
106+ ```
107+ juju add-relation postgresql:juju-info telegraf
108+ juju add-relation postgresql:db telegraf
109+ ```
110+
111+## Advanced
112+
113+### Input
114+
115+A basic set of input plugins are setup by default, which can be overriden
116+with the ``inputs_config`` configuration option. Both of these accept raw
117+telegraf configuration.
118+
119+To configure any of the (default or via relation) plugins, the
120+``extra_options`` charm config can be used. It's yaml, that needs to
121+be encoded as a string in the config. For example:
122+
123+ ```yaml
124+ telegraf:
125+ # The trailing | means the following indented section is all one string.
126+ extra_options: |
127+ inputs:
128+ cpu:
129+ percpu: false
130+ fielddrop: ["time_*"]
131+ disk:
132+ mount_points: ["/"]
133+ ignore_fs: ["tmpfs", "devtmpfs"]
134+ elasticsearch:
135+ local: false
136+ cluster_health: true
137+ postgresql:
138+ databases: ["foo", "bar"]
139+ tagpass:
140+ db: ["template", "postgres"]
141+ outputs:
142+ influxdb:
143+ precision: ms
144+ ```
145+
146+This extra options will only be applied to pligins configured via
147+relations and the following list (defined in ``templates/base_inputs.conf``):
148+ - inputs.cpu
149+ - inputs.disk
150+ - inputs.diskio
151+ - inputs.mem
152+ - inputs.net
153+ - inputs.netstat
154+ - inputs.swap
155+ - inputs.system
156+
157+
158+### Output
159+
160+The only output plugin supported via relation is influxdb, any other output
161+plugin needs to be configured manually (via juju set).
162+
163+To use a different metrics storage such as Graphite, the raw telegraf
164+plugin configuration needs to be set as a string in ``outputs_config``
165+configuration. For example:
166+
167+ ```yaml
168+ telegraf:
169+ # The trailing | indicates a multiline string in yaml.
170+ outputs_config: |
171+ [[outputs.graphite]]
172+ servers = ["10.0.3.231:2003"]
173+ prefix = "juju_local.devel.telegraf"
174+ timeout = 10
175+ ```
176
177 This will make telegraf agents to send the metrics to the graphite instance.
178
179 # Contact Information
180
181+- Prometheus Charming Project: https://launchpad.net/prometheus-charms
182+- Charm bugs: https://bugs.launchpad.net/telegraf-charm
183 - Upstream https://github.com/influxdata/telegraf
184 - Upstream bug tracker https://github.com/influxdata/telegraf/issues

Subscribers

People subscribed via source and target branches

to all changes: