Skip to content

Commit 180a708

Browse files
authored
Merge pull request SensorsIot#534 from Paraphraser/20220327-prometheus-doco-master
20220327 Prometheus documentation
2 parents 62b824e + 6c8f4aa commit 180a708

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

docs/Containers/Prometheus.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Prometheus
22

3-
## References
3+
## <a name="references"></a>References
44

55
* [*Prometheus* home](https://prometheus.io)
66
* *GitHub*:
@@ -15,19 +15,19 @@
1515
- [*CAdvisor*](https://hub.docker.com/r/zcube/cadvisor)
1616
- [*Node Exporter*](https://hub.docker.com/r/prom/node-exporter)
1717

18-
## Overview
18+
## <a name="overview"></a>Overview
1919

2020
Prometheus is a collection of three containers:
2121

2222
* *Prometheus*
2323
* *CAdvisor*
2424
* *Node Exporter*
2525

26-
The [default configuration](#active-configuration-file) for *Prometheus* supplied with IOTstack scrapes information from all three containers.
26+
The [default configuration](#activeConfig) for *Prometheus* supplied with IOTstack scrapes information from all three containers.
2727

28-
## Installing Prometheus
28+
## <a name="installProm"></a>Installing Prometheus
2929

30-
### *if you are running New Menu …*
30+
### <a name="installPromNewMenu"></a>*if you are running New Menu …*
3131

3232
When you select *Prometheus* in the IOTstack menu, you must also select:
3333

@@ -36,15 +36,15 @@ When you select *Prometheus* in the IOTstack menu, you must also select:
3636

3737
If you do not select all three containers, Prometheus will not start.
3838

39-
### *if you are running Old Menu …*
39+
### <a name="installPromOldMenu"></a>*if you are running Old Menu …*
4040

4141
When you select *Prometheus* in the IOTstack menu, the service definition includes the three containers:
4242

4343
* *prometheus*
4444
* *prometheus-cadvisor;* and
4545
* *prometheus-nodeexporter*.
4646

47-
## Significant directories and files
47+
## <a name="significantFiles"></a>Significant directories and files
4848

4949
```
5050
~/IOTstack
@@ -75,25 +75,25 @@ When you select *Prometheus* in the IOTstack menu, the service definition includ
7575
5. The *working service definition* (only relevant to old-menu, copied from ❶).
7676
6. The *Compose* file (includes ❶).
7777
7. The *persistent storage area*.
78-
8. The [configuration directory](#configuration-directory).
78+
8. The [configuration directory](#configDir).
7979

80-
## How *Prometheus* gets built for IOTstack
80+
## <a name="howPrometheusIOTstackGetsBuilt"></a>How *Prometheus* gets built for IOTstack
8181

82-
### *Prometheus* source code ([*GitHub*](https://github.com))
82+
### <a name="githubSourceCode"></a>*Prometheus* source code ([*GitHub*](https://github.com))
8383

8484
The source code for *Prometheus* lives at [*GitHub* prometheus/prometheus](https://github.com/prometheus/prometheus).
8585

86-
### *Prometheus* images ([*DockerHub*](https://hub.docker.com))
86+
### <a name="dockerHubImages"></a>*Prometheus* images ([*DockerHub*](https://hub.docker.com))
8787

8888
Periodically, the source code is recompiled and the resulting image is pushed to [prom/prometheus](https://hub.docker.com/r/prom/prometheus) on *DockerHub*.
8989

90-
### IOTstack menu
90+
### <a name="iotstackMenu"></a>IOTstack menu
9191

9292
When you select *Prometheus* in the IOTstack menu, the *template service definition* is copied into the *Compose* file.
9393

9494
> Under old menu, it is also copied to the *working service definition* and then not really used.
9595
96-
### IOTstack first run
96+
### <a name="iotstackFirstRun"></a>IOTstack first run
9797

9898
On a first install of IOTstack, you run the menu, choose *Prometheus* as one of your containers, and are told to do this:
9999

@@ -124,7 +124,7 @@ The *Dockerfile* begins with:
124124
FROM prom/prometheus:latest
125125
```
126126

127-
> If you need to pin to a particular version of *Prometheus*, the *Dockerfile* is the place to do it. See [*Prometheus* version pinning](#prometheus-version-pinning).
127+
> If you need to pin to a particular version of *Prometheus*, the *Dockerfile* is the place to do it. See [*Prometheus* version pinning](#versionPinning).
128128
129129
The `FROM` statement tells the build process to pull down the ***base image*** from [*DockerHub*](https://hub.docker.com).
130130

@@ -158,15 +158,15 @@ You *may* see the same pattern in Portainer, which reports the *base image* as "
158158

159159
> 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.
160160
161-
### Dependencies: *CAdvisor* and *Node Exporter*
161+
### <a name="dependencies"></a>Dependencies: *CAdvisor* and *Node Exporter*
162162

163163
The *CAdvisor* and *Node Exporter* are included in the *Prometheus* service definition as dependent containers. What that means is that each time you start *Prometheus*, `docker-compose` ensures that *CAdvisor* and *Node Exporter* are already running, and keeps them running.
164164

165-
The [default configuration](#active-configuration-file) for *Prometheus* assumes *CAdvisor* and *Node Exporter* are running and starts scraping information from those targets as soon as it launches.
165+
The [default configuration](#activeConfig) for *Prometheus* assumes *CAdvisor* and *Node Exporter* are running and starts scraping information from those targets as soon as it launches.
166166

167-
## Configuring **Prometheus**
167+
## <a name="configuringPrometheus"></a>Configuring **Prometheus**
168168

169-
### Configuration directory
169+
### <a name="configDir"></a>Configuration directory
170170

171171
The configuration directory for the IOTstack implementation of *Prometheus* is at the path:
172172

@@ -181,9 +181,9 @@ That directory contains two files:
181181

182182
If you delete either file, *Prometheus* will replace it with a default the next time the container starts. This "self-repair" function is intended to provide reasonable assurance that *Prometheus* will at least **start** instead of going into a restart loop.
183183

184-
Unless you [decide to change it](#environment-variables), the `config` folder and its contents are owned by "pi:pi". This means you can edit the files in the configuration directory without needing the `sudo` command. Ownership is enforced each time the container restarts.
184+
Unless you [decide to change it](#environmentVars), the `config` folder and its contents are owned by "pi:pi". This means you can edit the files in the configuration directory without needing the `sudo` command. Ownership is enforced each time the container restarts.
185185

186-
#### Active configuration file
186+
#### <a name="activeConfig"></a>Active configuration file
187187

188188
The file named `config.yml` is the active configuration. This is the file you should edit if you want to make changes. The default structure of the file is:
189189

@@ -213,7 +213,7 @@ Note:
213213

214214
* The YAML parser used by *Prometheus* seems to be ***exceptionally*** sensitive to syntax errors (far less tolerant than `docker-compose`). For this reason, you should **always** check the *Prometheus* log after any configuration change.
215215

216-
#### Reference configuration file
216+
#### <a name="referenceConfig"></a>Reference configuration file
217217

218218
The file named `prometheus.yml` is a reference configuration. It is a **copy** of the original configuration file that ships inside the *Prometheus* container at the path:
219219

@@ -231,7 +231,7 @@ $ docker-compose restart prometheus
231231
$ docker logs prometheus
232232
```
233233

234-
### Environment variables
234+
### <a name="environmentVars"></a>Environment variables
235235

236236
The IOTstack implementation of *Prometheus* supports two environment variables:
237237

@@ -241,11 +241,11 @@ environment:
241241
- IOTSTACK_GID=1000
242242
```
243243
244-
Those variables control ownership of the [Configuration directory](#configuration-directory) and its contents. Those environment variables are present in the standard IOTstack service definition for *Prometheus* and have the effect of assigning ownership to "pi:pi".
244+
Those variables control ownership of the [Configuration directory](#configDir) and its contents. Those environment variables are present in the standard IOTstack service definition for *Prometheus* and have the effect of assigning ownership to "pi:pi".
245245
246-
If you delete those environment variables from your *Compose* file, the [Configuration directory](#configuration-directory) will be owned by "nobody:nobody"; otherwise the directory and its contents will be owned by whatever values you pass for those variables.
246+
If you delete those environment variables from your *Compose* file, the [Configuration directory](#configDir) will be owned by "nobody:nobody"; otherwise the directory and its contents will be owned by whatever values you pass for those variables.
247247
248-
### Migration considerations
248+
### <a name="migration"></a>Migration considerations
249249
250250
Under the original IOTstack implementation of *Prometheus* (just "as it comes" from *DockerHub*), the service definition expected the configuration file to be at:
251251
@@ -276,7 +276,7 @@ Note:
276276

277277
* The YAML parser used by *Prometheus* is very sensitive to syntax errors. Always check the *Prometheus* log after any configuration change.
278278

279-
## Upgrading *Prometheus*
279+
## <a name="upgradingPrometheus"></a>Upgrading *Prometheus*
280280

281281
You can update `cadvisor` and `nodeexporter` like this:
282282

@@ -320,7 +320,7 @@ The `prune` is the simplest way of cleaning up. The first call removes the old *
320320

321321
> 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.
322322
323-
### *Prometheus* version pinning
323+
### <a name="versionPinning"></a>*Prometheus* version pinning
324324

325325
If you need to pin *Prometheus* to a particular version:
326326

0 commit comments

Comments
 (0)