You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## <aname="significantFiles"></a>Significant directories and files
17
17
18
18
```
19
19
~/IOTstack
@@ -38,34 +38,34 @@ The purpose of the Dockerfile is to:
38
38
39
39
1. The *Dockerfile* used to customise Telegraf for IOTstack.
40
40
2. A replacement for the `telegraf` container script of the same name, extended to handle container self-repair.
41
-
3. The *additions folder*. See [Applying optional additions](#applying-optional-additions).
41
+
3. The *additions folder*. See [Applying optional additions](#optionalAdditions).
42
42
4. The *auto_include folder*. Additions automatically applied to
43
-
`telegraf.conf`. See [Automatic includes to telegraf.conf](#automatic-includes-to-telegrafconf).
43
+
`telegraf.conf`. See [Automatic includes to telegraf.conf](#autoInclude).
44
44
5. The *template service definition*.
45
45
6. The *working service definition* (only relevant to old-menu, copied from ❹).
46
46
7. The *persistent storage area* for the `telegraf` container.
47
-
8. A working copy of the *additions folder* (copied from ❸). See [Applying optional additions](#applying-optional-additions).
48
-
9. The *reference configuration file*. See [Changing Telegraf's configuration](#changing-telegrafs-configuration).
47
+
8. A working copy of the *additions folder* (copied from ❸). See [Applying optional additions](#optionalAdditions).
48
+
9. The *reference configuration file*. See [Changing Telegraf's configuration](#editConfiguration).
49
49
10. The *active configuration file*. A subset of ➒ altered to support communication with InfluxDB running in a container in the same IOTstack instance.
50
50
51
51
Everything in the persistent storage area ❼:
52
52
53
53
* will be replaced if it is not present when the container starts; but
54
54
* will never be overwritten if altered by you.
55
55
56
-
## How Telegraf gets built for IOTstack
56
+
## <aname="howTelegrafIOTstackGetsBuilt"></a>How Telegraf gets built for IOTstack
Periodically, the source code is recompiled and the resulting image is pushed to [influxdata Telegraf](https://hub.docker.com/_/telegraf?tab=tags&page=1&ordering=last_updated) on *DockerHub*.
61
61
62
-
### IOTstack menu
62
+
### <aname="iotstackMenu"></a>IOTstack menu
63
63
64
64
When you select Telegraf in the IOTstack menu, the *template service definition* is copied into the *Compose* file.
65
65
66
66
> Under old menu, it is also copied to the *working service definition* and then not really used.
67
67
68
-
### IOTstack first run
68
+
### <aname="iotstackFirstRun"></a>IOTstack first run
69
69
70
70
On a first install of IOTstack, you run the menu, choose your containers, and are told to do this:
71
71
@@ -74,7 +74,7 @@ $ cd ~/IOTstack
74
74
$ docker-compose up -d
75
75
```
76
76
77
-
> See also the [Migration considerations](#migration-considerations) (below).
77
+
> See also the [Migration considerations](#migration) (below).
78
78
79
79
`docker-compose` reads the *Compose* file. When it arrives at the `telegraf` fragment, it finds:
80
80
@@ -99,7 +99,7 @@ The *Dockerfile* begins with:
99
99
FROM telegraf:latest
100
100
```
101
101
102
-
> If you need to pin to a particular version of Telegraf, the *Dockerfile* is the place to do it. See [Telegraf version pinning](#telegraf-version-pinning).
102
+
> If you need to pin to a particular version of Telegraf, the *Dockerfile* is the place to do it. See [Telegraf version pinning](#versionPinning).
103
103
104
104
The `FROM` statement tells the build process to pull down the ***base image*** from [*DockerHub*](https://hub.docker.com).
105
105
@@ -134,7 +134,7 @@ You *may* see the same pattern in *Portainer*, which reports the ***base image**
134
134
135
135
> Whether you see one or two rows depends on the version of `docker-compose` you are using and how your version of `docker-compose` builds local images.
Under the original IOTstack implementation of Telegraf (just "as it comes" from *DockerHub*), the service definition expected `telegraf.conf` to be at:
140
140
@@ -154,9 +154,9 @@ With one exception, all prior and current versions of the default configuration
154
154
155
155
> In other words, once you strip away comments and blank lines, and remove any "active" configuration options that simply repeat their default setting, you get the same subset of "active" configuration options. The default configuration file supplied with gcgarner/IOTstack is available [here](https://github.com/gcgarner/IOTstack/blob/master/.templates/telegraf/telegraf.conf) if you wish to refer to it.
156
156
157
-
The exception is `[[inputs.mqtt_consumer]]` which is now provided as an optional addition. If your existing Telegraf configuration depends on that input, you will need to apply it. See [applying optional additions](#applying-optional-additions).
157
+
The exception is `[[inputs.mqtt_consumer]]` which is now provided as an optional addition. If your existing Telegraf configuration depends on that input, you will need to apply it. See [applying optional additions](#optionalAdditions).
158
158
159
-
## Logging
159
+
## <aname="logging"></a>Logging
160
160
161
161
You can inspect Telegraf's log by:
162
162
@@ -166,7 +166,7 @@ $ docker logs telegraf
166
166
167
167
These logs are ephemeral and will disappear when your Telegraf container is rebuilt.
@@ -178,7 +178,7 @@ If InfluxDB is not running when Telegraf starts, the `depends_on:` clause in Tel
178
178
179
179
What this error message *usually* means is that Telegraf has tried to communicate with InfluxDB before the latter is ready to accept connections. Telegraf typically retries after a short delay and is then able to communicate with InfluxDB.
The first time you launch the Telegraf container, the following structure will be created in the persistent storage area:
184
184
@@ -204,7 +204,7 @@ The file:
204
204
- is created by removing all comment lines and blank lines from `telegraf-reference.conf`, leaving only the "active" configuration options, and then adding options necessary for IOTstack.
205
205
- is less than 30 lines and is significantly easier to understand than `telegraf-reference.conf`.
206
206
207
-
*`inputs.docker.conf` – see [Applying optional additions](#applying-optional-additions) below.
207
+
*`inputs.docker.conf` – see [Applying optional additions](#optionalAdditions) below.
208
208
209
209
The intention of this structure is that you:
210
210
@@ -219,7 +219,7 @@ $ cd ~/IOTstack
219
219
$ docker-compose restart telegraf
220
220
```
221
221
222
-
### Automatic includes to telegraf.conf
222
+
### <aname="autoInclude"></a>Automatic includes to telegraf.conf
223
223
224
224
*`inputs.docker.conf` instructs Telegraf to collect metrics from Docker. Requires kernel control
225
225
groups to be enabled to collect memory usage data. If not done during initial installation,
The *additions folder* (see [Significant directories and files](#significant-directories-and-files)) is a mechanism for additional *IOTstack-ready* configuration options to be provided for Telegraf.
234
+
The *additions folder* (see [Significant directories and files](#significantFiles)) is a mechanism for additional *IOTstack-ready* configuration options to be provided for Telegraf.
The `grep` strips comment lines and the `sudo tee` is a safe way of appending the result to `telegraf.conf`. The `restart` causes Telegraf to notice the change.
251
251
252
-
## Getting a clean slate
252
+
## <aname="cleanSlate"></a>Getting a clean slate
253
253
254
-
### Erasing the persistent storage area
254
+
### <aname="resetDB"></a>Erasing the persistent storage area
255
255
256
256
Erasing Telegraf's persistent storage area triggers self-healing and restores known defaults:
257
257
@@ -272,7 +272,7 @@ Note:
272
272
$ docker-compose restart telegraf
273
273
```
274
274
275
-
### Resetting the InfluxDB database
275
+
### <aname="resetDB"></a>Resetting the InfluxDB database
276
276
277
277
To reset the InfluxDB database that Telegraf writes into, proceed like this:
278
278
@@ -293,7 +293,7 @@ In words:
293
293
* Delete the `telegraf` database, and then exit the CLI.
294
294
* Start the Telegraf container. This re-creates the database automatically.
@@ -335,7 +335,7 @@ Your existing Telegraf container continues to run while the rebuild proceeds. On
335
335
336
336
The `prune` is the simplest way of cleaning up. The first call removes the old ***local image***. The second call cleans up the old ***base image***. Whether an old ***base image*** exists depends on the version of `docker-compose` you are using and how your version of `docker-compose` builds local images.
337
337
338
-
### Telegraf version pinning
338
+
### <aname="versionPinning"></a>Telegraf version pinning
339
339
340
340
If you need to pin Telegraf to a particular version:
0 commit comments