Merge ~sergiodj/ubuntu/+source/telegraf:bug1916305-telegraf-conf into ~ubuntu-server/ubuntu/+source/telegraf:master

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: Sergio Durigan Junior
Approved revision: 1f84544c5103b094bd4cebb827da494f11e95fa7
Merged at revision: 1cdb11740aaeebfbabb57ea3bd102888648e2c56
Proposed branch: ~sergiodj/ubuntu/+source/telegraf:bug1916305-telegraf-conf
Merge into: ~ubuntu-server/ubuntu/+source/telegraf:master
Diff against target: 102 lines (+62/-7)
4 files modified
debian/changelog (+13/-0)
debian/patches/adjust-etc-telegraf.conf.patch (+48/-0)
debian/patches/series (+1/-0)
debian/tests/basic-outputs (+0/-7)
Reviewer Review Type Date Requested Status
Bryce Harrington Needs Fixing
Canonical Server Pending
Review via email: mp+398402@code.launchpad.net

Description of the change

Fix for bug 1916305.

In a nutshell: after installing telegraf, it will always try to connect to an influxdb instance. This is because of the default configuration file shipped with it. When it fails, it generated *a lot* of pollution in the log files. Since we might not always have such an instance in the system, it makes sense to disable this by default. And given that, by design, telegraf must always have at least one output configured, this MP enables the prometheus_client output, which should be harmless and is actually a good thing to allow the user to verify whether things are running OK.

There's a build with the proposed change here:

https://launchpad.net/~sergiodj/+archive/ubuntu/telegraf-merge

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Yeah I remember these changes when doing the LMA docs. Dropping the influxdb config makes sense.

In testing upgrading to this version from an existing installation will prompt the user to confirm the config change. However, it looks like we only introduced telegraf as of groovy, so the impact on users can probably be considered negligible.

Other than that, the installation seems to work ok.

autopkgtest has been running `test basic-outputs` for a while for me in lxc, but seems to be stuck. Did you successfully verify autopkgtest already?

I spotted a small text error in the changelog. I also have some phrasing suggestions but that you can take or leave as you wish. No need to re-review after fixing those, you can go ahead and just land.

review: Needs Fixing
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the review, Bryce.

Indeed, the autopkgtest is hanging there. I submitted the MP before running it, and I should have waited. Anyway, I already know why it's not finishing: if you look at the test, the initial part of it is actually doing exactly what this MP is proposing, so the fix is to actually remove this part, and everything runs nicely.

I thank you for spotting the (rather dumb) mistake in the changelog entry, and for the Bug-Ubuntu suggestion: I've fixed everything now.

I went ahead and pushed + uploaded everything:

$ gbp tag
gbp:info: Tagging Debian package 1.17.2+ds1-0ubuntu2 as debian/1.17.2+ds1-0ubuntu2 in git
$ gbp push
gbp:info: Pushing debian/1.17.2+ds1-0ubuntu2 to origin
gbp:info: Pushing upstream/1.17.2+ds1 to origin
gbp:info: Pushing refs/heads/master to origin:refs/heads/master
gbp:info: Pushing refs/heads/upstream to origin:refs/heads/upstream
gbp:info: Pushing refs/heads/pristine-tar to origin:refs/heads/pristine-tar
$ dput telegraf_1.17.2+ds1-0ubuntu2_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/telegraf/telegraf_1.17.2+ds1-0ubuntu2_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/telegraf/telegraf_1.17.2+ds1-0ubuntu2.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading telegraf_1.17.2+ds1-0ubuntu2.dsc: done.
  Uploading telegraf_1.17.2+ds1-0ubuntu2.debian.tar.xz: done.
  Uploading telegraf_1.17.2+ds1-0ubuntu2_source.buildinfo: done.
  Uploading telegraf_1.17.2+ds1-0ubuntu2_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 3669daf..dcf24af 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,16 @@
6+telegraf (1.17.2+ds1-0ubuntu2) hirsute; urgency=medium
7+
8+ * d/p/adjust-etc-telegraf.conf.patch: Adjust /etc/telegraf.conf.
9+ Change telegraf's default configuration to not attempt connecting to
10+ an influxdb instance, as it's not required for installation and thus
11+ may not be present. (LP: #1916305)
12+ * d/t/basic-outputs: Update and simplify test preparation.
13+ With the change in the configuration file, there is no more need to
14+ comment out the influxdb output nor to add the prometheus_client
15+ output.
16+
17+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Fri, 19 Feb 2021 23:46:34 -0500
18+
19 telegraf (1.17.2+ds1-0ubuntu1) hirsute; urgency=medium
20
21 * d/repack-telegraf-with-vendor.sh: Fix "trap" instruction.
22diff --git a/debian/patches/adjust-etc-telegraf.conf.patch b/debian/patches/adjust-etc-telegraf.conf.patch
23new file mode 100644
24index 0000000..e424fa4
25--- /dev/null
26+++ b/debian/patches/adjust-etc-telegraf.conf.patch
27@@ -0,0 +1,48 @@
28+From: Sergio Durigan Junior <sergio.durigan@canonical.com>
29+Date: Fri, 19 Feb 2021 18:00:08 -0500
30+Subject: Adjust /etc/telegraf.conf
31+
32+Change telegraf's default configuration to not attempt connecting to
33+an influxdb instance, as it's not required for installation and thus
34+may not be present.
35+
36+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/telegraf/+bug/1916305
37+Forwarded: not-needed
38+---
39+ etc/telegraf.conf | 8 ++++----
40+ 1 file changed, 4 insertions(+), 4 deletions(-)
41+
42+diff --git a/etc/telegraf.conf b/etc/telegraf.conf
43+index 9d52d0a..7efb747 100644
44+--- a/etc/telegraf.conf
45++++ b/etc/telegraf.conf
46+@@ -102,7 +102,7 @@
47+
48+
49+ # Configuration for sending metrics to InfluxDB
50+-[[outputs.influxdb]]
51++#[[outputs.influxdb]]
52+ ## The full HTTP or UDP URL for your InfluxDB instance.
53+ ##
54+ ## Multiple URLs can be specified for a single cluster, only ONE of the
55+@@ -1203,9 +1203,9 @@
56+
57+
58+ # # Configuration for the Prometheus client to spawn
59+-# [[outputs.prometheus_client]]
60++[[outputs.prometheus_client]]
61+ # ## Address to listen on
62+-# listen = ":9273"
63++ listen = ":9273"
64+ #
65+ # ## Metric version controls the mapping from Telegraf metrics into
66+ # ## Prometheus format. When using the prometheus input, use the same value in
67+@@ -1213,7 +1213,7 @@
68+ # ##
69+ # ## example: metric_version = 1; deprecated in 1.13
70+ # ## metric_version = 2; recommended version
71+-# # metric_version = 1
72++ metric_version = 2
73+ #
74+ # ## Use HTTP Basic Authentication.
75+ # # basic_username = "Foo"
76diff --git a/debian/patches/series b/debian/patches/series
77index 74d79c4..7de5f2c 100644
78--- a/debian/patches/series
79+++ b/debian/patches/series
80@@ -1 +1,2 @@
81 adjust-service-user.patch
82+adjust-etc-telegraf.conf.patch
83diff --git a/debian/tests/basic-outputs b/debian/tests/basic-outputs
84index fa29a75..0d844d1 100644
85--- a/debian/tests/basic-outputs
86+++ b/debian/tests/basic-outputs
87@@ -7,15 +7,8 @@ set -e
88 set -x
89 set -o pipefail
90
91-# Disable the influxdb output plugin since we won't be using it.
92-sed -i 's@^\(\[\[outputs.influxdb\]\]\)$@#\1@' /etc/telegraf/telegraf.conf
93-
94 # Enable some output plugins.
95 cat >> /etc/telegraf/telegraf.conf << EOF
96-[[outputs.prometheus_client]]
97- listen = "127.0.0.1:9273"
98- metric_version = 2
99-
100 [[outputs.http]]
101 url = "http://127.0.0.1:8080/"
102 EOF

Subscribers

People subscribed via source and target branches