Skip to content

Commit 07514a5

Browse files
committed
20220117 prometheus - master branch
[Issue 472](#472) reports a new-menu problem where selecting Prometheus does not install cadvisor and nodeexporter. The template `service.yml` for Prometheus contains all three service definitions. It is not clear why cadvisor and nodeexporter are being removed prior to their insertion into the compose file. > NextCloud and NextCloud_DB are both defined in a single `service.yml`. Both services make it into the compose file so a working pattern exists for this basic approach. Prior to [PR419](#419), the template contained `build.sh`, `service_cadvisor-arm.yml` and `service_node-exporter.yml` as well as `service.yml`. That was not working under new-menu, possibly explained by the following line in `build.sh`: ``` ``` This Pull Request adopts a brute-force approach by having three separate templates for new-menu: * prometheus * prometheus-cadvisor * prometheus-nodeexporter The naming structure ensures all three sort together in the menu. Documentation updated to make it clear that all three need to be selected. Networks directives removed from all three as part of related PRs and minimise the potential for conflicts. Signed-off-by: Phill Kelley <[email protected]>
1 parent f876d33 commit 07514a5

File tree

4 files changed

+41
-48
lines changed

4 files changed

+41
-48
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
prometheus-cadvisor:
2+
container_name: cadvisor
3+
image: zcube/cadvisor:latest
4+
restart: unless-stopped
5+
ports:
6+
- "8082:8080"
7+
volumes:
8+
- /:/rootfs:ro
9+
- /var/run:/var/run:rw
10+
- /sys:/sys:ro
11+
- /var/lib/docker/:/var/lib/docker:ro
12+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
prometheus-nodeexporter:
2+
container_name: nodeexporter
3+
image: prom/node-exporter:latest
4+
restart: unless-stopped
5+
expose:
6+
- "9100"
7+

.templates/prometheus/service.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,4 @@ prometheus:
2020
depends_on:
2121
- cadvisor
2222
- nodeexporter
23-
networks:
24-
- iotstack_nw
2523

26-
cadvisor:
27-
container_name: cadvisor
28-
image: zcube/cadvisor:latest
29-
restart: unless-stopped
30-
ports:
31-
- "8082:8080"
32-
volumes:
33-
- /:/rootfs:ro
34-
- /var/run:/var/run:rw
35-
- /sys:/sys:ro
36-
- /var/lib/docker/:/var/lib/docker:ro
37-
networks:
38-
- iotstack_nw
39-
40-
nodeexporter:
41-
container_name: nodeexporter
42-
image: prom/node-exporter:latest
43-
restart: unless-stopped
44-
expose:
45-
- "9100"
46-
networks:
47-
- iotstack_nw

docs/Containers/Prometheus.md

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

3-
- [References](#references)
4-
- [Significant directories and files](#significantFiles)
5-
- [How Prometheus gets built for IOTstack](#howPrometheusIOTstackGetsBuilt)
6-
- [Prometheus source code](#githubSourceCode)
7-
- [Prometheus images](#dockerHubImages)
8-
- [IOTstack menu](#iotstackMenu)
9-
- [IOTstack first run](#iotstackFirstRun)
10-
- [Dependencies: *CAdvisor* and *Node Exporter*](#dependencies)
11-
- [Configuring Prometheus](#configuringPrometheus)
12-
- [Configuration directory](#configDir)
13-
- [Active configuration file](#activeConfig)
14-
- [Reference configuration file](#referenceConfig)
15-
- [Environment variables](#environmentVars)
16-
- [Migration considerations](#migration)
17-
- [Upgrading Prometheus](#upgradingPrometheus)
18-
- [Prometheus version pinning](#versionPinning)
19-
20-
<hr>
21-
223
## <a name="references"> References </a>
234

245
* [*Prometheus* home](https://prometheus.io)
@@ -36,14 +17,33 @@
3617

3718
## <a name="overview"> Overview </a>
3819

39-
Three containers are installed when you select *Prometheus* in the IOTstack menu:
20+
Prometheus is a collection of three containers:
4021

4122
* *Prometheus*
4223
* *CAdvisor*
4324
* *Node Exporter*
4425

4526
The [default configuration](#activeConfig) for *Prometheus* supplied with IOTstack scrapes information from all three containers.
4627

28+
## <a name="installProm"> Installing Prometheus </a>
29+
30+
### <a name="installPromNewMenu"> *if you are running New Menu …* </a>
31+
32+
When you select *Prometheus* in the IOTstack menu, you must also select:
33+
34+
* *prometheus-cadvisor;* and
35+
* *prometheus-nodeexporter*.
36+
37+
If you do not select all three containers, Prometheus will not start.
38+
39+
### <a name="installPromOldMenu"> *if you are running Old Menu …* </a>
40+
41+
When you select *Prometheus* in the IOTstack menu, the service definition includes the three containers:
42+
43+
* *Prometheus*
44+
* *CAdvisor*
45+
* *Node Exporter*
46+
4747
## <a name="significantFiles"> Significant directories and files </a>
4848

4949
```
@@ -276,11 +276,11 @@ Note:
276276

277277
## <a name="upgradingPrometheus"> Upgrading *Prometheus* </a>
278278

279-
You can update most containers like this:
279+
You can update `cadvisor` and `nodeexporter` like this:
280280

281281
```bash
282282
$ cd ~/IOTstack
283-
$ docker-compose pull
283+
$ docker-compose pull cadvisor nodeexporter
284284
$ docker-compose up -d
285285
$ docker system prune
286286
```
@@ -291,8 +291,6 @@ In words:
291291
* `docker-compose up -d` causes any newly-downloaded images to be instantiated as containers (replacing the old containers); and
292292
* the `prune` gets rid of the outdated images.
293293

294-
The auxiliary containers `cadvisor` and `nodeexporter` are updated via this method.
295-
296294
This "simple pull" strategy doesn't work when a *Dockerfile* is used to build a *local image* on top of a *base image* downloaded from [*DockerHub*](https://hub.docker.com). The *local image* is what is running so there is no way for the `pull` to sense when a newer version becomes available.
297295

298296
The only way to know when an update to *Prometheus* is available is to check the [prom/prometheus tags page](https://hub.docker.com/r/prom/prometheus/tags?page=1&ordering=last_updated) on *DockerHub*.

0 commit comments

Comments
 (0)