Skip to content

Commit 80cad40

Browse files
committed
Update Examples README.md
Signed-off-by: Weifeng Wang <qclaogui@gmail.com> Update README.md Signed-off-by: Weifeng Wang <qclaogui@gmail.com> Better Update README.md Signed-off-by: Weifeng Wang <qclaogui@gmail.com>
1 parent 059c982 commit 80cad40

File tree

9 files changed

+190
-73
lines changed

9 files changed

+190
-73
lines changed

docker-compose/monolithic-mode/metrics/compose.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ version: '3.9'
1010
include:
1111
- path: ../../common/compose-include/minio.yaml
1212
- path: ../../common/compose-include/memcached.yaml
13-
- path: ../../common/compose-include/mimir.yaml
1413
- path: ../../common/compose-include/grafana.yaml
1514

1615
services:
@@ -70,3 +69,43 @@ services:
7069
interval: 10s
7170
timeout: 5s
7271
retries: 5
72+
73+
mimir:
74+
depends_on:
75+
minio:
76+
condition: service_healthy
77+
image: ${MIMIR_IMAGE:-docker.io/grafana/mimir:2.11.0}
78+
volumes:
79+
- ../config/mimir:/etc/mimir
80+
command:
81+
- -config.file=/etc/mimir/monolithic-mode-metrics.yaml
82+
- -target=all
83+
- -config.expand-env=true
84+
healthcheck:
85+
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/ready || exit 1" ]
86+
interval: 10s
87+
timeout: 5s
88+
retries: 5
89+
# expose 38080 port so we can directly access mimir inside container
90+
ports:
91+
- "38080:8080"
92+
networks:
93+
default:
94+
aliases:
95+
- mimir-memberlist
96+
97+
mimirtool:
98+
labels:
99+
metrics.agent.grafana.com/scrape: false
100+
image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:2.11.0}
101+
volumes:
102+
- ../../../monitoring-mixins/crontab:/etc/crontabs/root
103+
- ../../../monitoring-mixins/agent-flow-mixin/deploy/agent-flow-mixin-alerts.yaml:/rules/agent-flow-mixin-alerts.yaml
104+
- ../../../monitoring-mixins/memcached-mixin/deploy/memcached-mixin-alerts.yaml:/rules/memcached-mixin-alerts.yaml
105+
- ../../../monitoring-mixins/mimir-mixin/deploy/mimir-mixin-rules.yaml:/rules/mimir-mixin-rules.yaml
106+
- ../../../monitoring-mixins/mimir-mixin/deploy/mimir-mixin-alerts.yaml:/rules/mimir-mixin-alerts.yaml
107+
environment:
108+
- MIMIR_ADDRESS=http://gateway:8080
109+
- MIMIR_TENANT_ID=anonymous
110+
entrypoint: crond -f
111+
restart: always

examples/README.md

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,56 @@
22

33
This directory contains examples, including:
44

5-
- [github-exporter](./github-exporter/README.md)
5+
- [github-exporter-with-mixin](./ghe-with-mixin)
6+
- [github-exporter-with-simple-dashboards](./ghe-with-simple-dashboards)
7+
- [github-exporter](./github-exporter)
8+
- [grafana-oncall-integration](./grafana-oncall)
69

7-
The following ports will be exposed on the host:
10+
## Debug info
811

9-
- Loki on <http://localhost:33100>
10-
- Grafana on <http://localhost:3000>
11-
- Grafana Agent on <http://localhost:12345>
12-
- Tempo on <http://localhost:33200>
13-
- Mimir on <http://localhost:38080>
14-
- Pyroscope on <http://localhost:34040>
12+
`grafana-agent` target scrape:
1513

16-
The Minio console is available at <http://localhost:9001>
14+
<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>
15+
16+
## Grafana LGTMP Stack default port-mapping
17+
18+
| Port-mapping | Component | Description |
19+
| --- | --- | --- |
20+
| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
21+
| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container |
22+
| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container |
23+
| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container |
24+
| `38080:8080` | [Mimir][5] | Expose `38080` port so we can directly access `mimir` inside container |
25+
| `34040:4040` | [Pyroscope][6] | Expose `34040` port so we can directly access `pyroscope` inside container |
26+
| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
27+
| `39000:9000`, `2500`, `1100` | [Inbucket][8] | Expose `39000` port to use for the email testing server web interface. |
28+
29+
[1]: https://github.com/grafana/agent
30+
[2]: https://github.com/grafana/loki
31+
[3]: https://github.com/grafana/grafana
32+
[4]: https://github.com/grafana/tempo
33+
[5]: https://github.com/grafana/mimir
34+
[6]: https://github.com/grafana/pyroscope
35+
[7]: https://github.com/minio/minio
36+
[8]: https://github.com/inbucket/inbucket
37+
38+
## Resource Utilization
39+
40+
```shell
41+
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats
42+
```
43+
44+
```shell
45+
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
46+
613d8d5e7e30 root-grafana-agent-1 2.72% 180.7MiB / 1.889GiB 9.34% 1.46MB / 4.61MB 3.15MB / 1.56MB 11
47+
53443e6d4c31 root-gateway-1 0.00% 8.102MiB / 1.889GiB 0.42% 497kB / 503kB 6.45MB / 20.5kB 3
48+
750ace278979 root-mimir-1 1.06% 121.2MiB / 1.889GiB 6.27% 5.09MB / 888kB 111kB / 8.7MB 8
49+
acb81816e078 root-loki-1 1.11% 83.13MiB / 1.889GiB 4.30% 157kB / 336kB 56.2MB / 340kB 8
50+
f5f28089da9c root-memcached-1 0.03% 6.762MiB / 1.889GiB 0.35% 31.6kB / 128kB 0B / 0B 10
51+
a91be648c677 root-memcached-exporter-1 0.00% 7.125MiB / 1.889GiB 0.37% 126kB / 75.2kB 0B / 0B 5
52+
4f755dee256b root-minio-1 3.99% 163.3MiB / 1.889GiB 8.44% 367kB / 889kB 1.77MB / 557kB 12
53+
fab3799e6a97 root-grafana-1 7.37% 72.63MiB / 1.889GiB 3.76% 666kB / 790kB 1.01MB / 34.2MB 9
54+
d16d6664924c root-load-rules-to-mimir-1 0.00% 31.69MiB / 1.889GiB 1.64% 54.7kB / 117kB 44.9MB / 4.1kB 1
55+
72262bb29bd1 root-github-exporter-1 0.00% 9.906MiB / 1.889GiB 0.51% 141kB / 41.4kB 3.4MB / 0B 5
56+
57+
```

examples/ghe-with-mixin/README.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,38 @@ Exposes basic metrics for your repositories from the GitHub API, to a Prometheus
44

55
## Docker compose
66

7+
`compose.yaml`:
8+
79
```yaml
810
include:
11+
# use git remote
912
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
13+
# use local path
14+
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml
1015

1116
services:
1217
github-exporter:
18+
labels:
19+
metrics.agent.grafana.com/scrape: true
1320
image: githubexporter/github-exporter:1.1.0
1421
environment:
15-
- REPOS=qclaogui/codelab-monitoring
22+
- REPOS=grafana/agent
23+
```
1624
25+
`compose.override.yaml`:
26+
27+
```yaml
28+
services:
29+
# override included service grafana for dashboards pre-provisioning
30+
grafana:
31+
volumes:
32+
- ../../monitoring-mixins/github-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/github-mixin
33+
34+
# override included service mimirtool for rules and alerts pre-provisioning
35+
mimirtool:
36+
volumes:
37+
- ../../monitoring-mixins/github-mixin/deploy/github-mixin-rules.yaml:/rules/github-mixin-rules.yaml
38+
- ../../monitoring-mixins/github-mixin/deploy/github-mixin-alerts.yaml:/rules/github-mixin-alerts.yaml
1739
```
1840

1941
## Try it
@@ -22,37 +44,14 @@ services:
2244
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
2345
```
2446

25-
```shell
26-
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
27-
```
28-
2947
Once all containers are up and running you can search for metrics(from Mimir) logs(from Loki) traces(from Tempo) and profiles(Pyroscope) in Grafana.
3048

3149
> In this case you can find `github-exporter` metrics and logs.
3250

3351
Navigate to [http://localhost:3000](http://localhost:3000)
3452

35-
## Debug info(`grafana-agent` target scrape)
36-
37-
<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>
38-
39-
## Resource Utilization
40-
41-
```shell
42-
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats
43-
```
53+
## Stop services
4454

4555
```shell
46-
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
47-
613d8d5e7e30 root-grafana-agent-1 2.72% 180.7MiB / 1.889GiB 9.34% 1.46MB / 4.61MB 3.15MB / 1.56MB 11
48-
53443e6d4c31 root-gateway-1 0.00% 8.102MiB / 1.889GiB 0.42% 497kB / 503kB 6.45MB / 20.5kB 3
49-
750ace278979 root-mimir-1 1.06% 121.2MiB / 1.889GiB 6.27% 5.09MB / 888kB 111kB / 8.7MB 8
50-
acb81816e078 root-loki-1 1.11% 83.13MiB / 1.889GiB 4.30% 157kB / 336kB 56.2MB / 340kB 8
51-
f5f28089da9c root-memcached-1 0.03% 6.762MiB / 1.889GiB 0.35% 31.6kB / 128kB 0B / 0B 10
52-
a91be648c677 root-memcached-exporter-1 0.00% 7.125MiB / 1.889GiB 0.37% 126kB / 75.2kB 0B / 0B 5
53-
4f755dee256b root-minio-1 3.99% 163.3MiB / 1.889GiB 8.44% 367kB / 889kB 1.77MB / 557kB 12
54-
fab3799e6a97 root-grafana-1 7.37% 72.63MiB / 1.889GiB 3.76% 666kB / 790kB 1.01MB / 34.2MB 9
55-
d16d6664924c root-load-rules-to-mimir-1 0.00% 31.69MiB / 1.889GiB 1.64% 54.7kB / 117kB 44.9MB / 4.1kB 1
56-
72262bb29bd1 root-github-exporter-1 0.00% 9.906MiB / 1.889GiB 0.51% 141kB / 41.4kB 3.4MB / 0B 5
57-
56+
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
5857
```

examples/ghe-with-mixin/compose.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
1111
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
1212
include:
13-
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
14-
# Local
15-
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
13+
# use git remote
14+
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
15+
# use local path
16+
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml
1617

1718
services:
1819
github-exporter:
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Prometheus GitHub Exporter
2+
3+
Exposes basic metrics for your repositories from the GitHub API, to a Prometheus compatible endpoint.
4+
5+
## Docker compose
6+
7+
`compose.yaml`:
8+
9+
```yaml
10+
include:
11+
# use git remote
12+
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
13+
# use local path
14+
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml
15+
16+
services:
17+
github-exporter:
18+
labels:
19+
metrics.agent.grafana.com/scrape: true
20+
image: githubexporter/github-exporter:1.1.0
21+
environment:
22+
- REPOS=grafana/agent
23+
```
24+
25+
`compose.override.yaml`:
26+
27+
```yaml
28+
services:
29+
# override included service grafana for dashboards pre-provisioning
30+
grafana:
31+
volumes:
32+
- ./dashboards:/var/lib/grafana/dashboards/github-mixin
33+
```
34+
35+
## Try it
36+
37+
```shell
38+
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
39+
```
40+
41+
Once all containers are up and running you can search for metrics(from Mimir) logs(from Loki) traces(from Tempo) and profiles(Pyroscope) in Grafana.
42+
43+
> In this case you can find `github-exporter` metrics and logs.
44+
45+
Navigate to [http://localhost:3000](http://localhost:3000)
46+
47+
## Stop services
48+
49+
```shell
50+
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
51+
```

examples/ghe-with-simple-dashboards/compose.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
1111
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
1212
include:
13-
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
14-
# Local
15-
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
13+
# use git remote
14+
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
15+
# use local path
16+
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml
1617

1718
services:
1819
github-exporter:

examples/github-exporter/README.md

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ Exposes basic metrics for your repositories from the GitHub API, to a Prometheus
44

55
## Docker compose
66

7-
```yaml
7+
`compose.yaml`:
88

9+
```yaml
910
include:
11+
# use git remote
1012
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
13+
# use local path
14+
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml
1115

12-
# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/agent-flow/modules/docker/README.md
1316
services:
1417
github-exporter:
18+
labels:
19+
metrics.agent.grafana.com/scrape: true
1520
image: githubexporter/github-exporter:1.1.0
1621
environment:
17-
- REPOS=qclaogui/codelab-monitoring
18-
22+
- REPOS=grafana/agent
1923
```
2024
2125
## Try it
@@ -24,37 +28,14 @@ services:
2428
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
2529
```
2630

27-
```shell
28-
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
29-
```
30-
3131
Once all containers are up and running you can search for metrics(from Mimir) logs(from Loki) traces(from Tempo) and profiles(Pyroscope) in Grafana.
3232

3333
> In this case you can find `github-exporter` metrics and logs.
3434
3535
Navigate to [http://localhost:3000](http://localhost:3000)
3636

37-
## Debug info(`grafana-agent` target scrape)
38-
39-
<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>
40-
41-
## Resource Utilization
37+
## Stop services
4238

4339
```shell
44-
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats
45-
```
46-
47-
```shell
48-
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
49-
613d8d5e7e30 root-grafana-agent-1 2.72% 180.7MiB / 1.889GiB 9.34% 1.46MB / 4.61MB 3.15MB / 1.56MB 11
50-
53443e6d4c31 root-gateway-1 0.00% 8.102MiB / 1.889GiB 0.42% 497kB / 503kB 6.45MB / 20.5kB 3
51-
750ace278979 root-mimir-1 1.06% 121.2MiB / 1.889GiB 6.27% 5.09MB / 888kB 111kB / 8.7MB 8
52-
acb81816e078 root-loki-1 1.11% 83.13MiB / 1.889GiB 4.30% 157kB / 336kB 56.2MB / 340kB 8
53-
f5f28089da9c root-memcached-1 0.03% 6.762MiB / 1.889GiB 0.35% 31.6kB / 128kB 0B / 0B 10
54-
a91be648c677 root-memcached-exporter-1 0.00% 7.125MiB / 1.889GiB 0.37% 126kB / 75.2kB 0B / 0B 5
55-
4f755dee256b root-minio-1 3.99% 163.3MiB / 1.889GiB 8.44% 367kB / 889kB 1.77MB / 557kB 12
56-
fab3799e6a97 root-grafana-1 7.37% 72.63MiB / 1.889GiB 3.76% 666kB / 790kB 1.01MB / 34.2MB 9
57-
d16d6664924c root-load-rules-to-mimir-1 0.00% 31.69MiB / 1.889GiB 1.64% 54.7kB / 117kB 44.9MB / 4.1kB 1
58-
72262bb29bd1 root-github-exporter-1 0.00% 9.906MiB / 1.889GiB 0.51% 141kB / 41.4kB 3.4MB / 0B 5
59-
40+
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
6041
```

examples/github-exporter/compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
1111
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
1212
include:
13+
# use git remote
1314
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/all-in-one/compose.yaml # All in one(Logs Traces Metrics Profiles)
1415
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/metrics/compose.yaml # Metrics
1516
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml # Metrics and Logs
1617
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/traces/compose.yaml # Metrics and Traces
1718
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/profiles/compose.yaml # Metrics and Profiles
1819

19-
# Local
20+
# use local path
2021
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
2122
# - path: ../../docker-compose/read-write-mode/logs/compose.yaml
2223
# - path: ../../docker-compose/microservices-mode/logs/compose.yaml

examples/grafana-oncall/compose.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
1111
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
1212
include:
13-
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
13+
# use git remote
14+
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
15+
# use local path
16+
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml
1417

1518
x-environment: &oncall-environment
1619
SEND_ANONYMOUS_USAGE_STATS: ${SEND_ANONYMOUS_USAGE_STATS:-false}

0 commit comments

Comments
 (0)