Skip to content

Commit

Permalink
Update Examples README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Weifeng Wang <[email protected]>

Update README.md

Signed-off-by: Weifeng Wang <[email protected]>

Better

Update README.md

Signed-off-by: Weifeng Wang <[email protected]>

Update README.md

Signed-off-by: Weifeng Wang <[email protected]>
  • Loading branch information
qclaogui committed Apr 2, 2024
1 parent 059c982 commit 0be2244
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 82 deletions.
41 changes: 40 additions & 1 deletion docker-compose/monolithic-mode/metrics/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ version: '3.9'
include:
- path: ../../common/compose-include/minio.yaml
- path: ../../common/compose-include/memcached.yaml
- path: ../../common/compose-include/mimir.yaml
- path: ../../common/compose-include/grafana.yaml

services:
Expand Down Expand Up @@ -70,3 +69,43 @@ services:
interval: 10s
timeout: 5s
retries: 5

mimir:
depends_on:
minio:
condition: service_healthy
image: ${MIMIR_IMAGE:-docker.io/grafana/mimir:2.11.0}
volumes:
- ../config/mimir:/etc/mimir
command:
- -config.file=/etc/mimir/monolithic-mode-metrics.yaml
- -target=all
- -config.expand-env=true
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
# expose 38080 port so we can directly access mimir inside container
ports:
- "38080:8080"
networks:
default:
aliases:
- mimir-memberlist

mimirtool:
labels:
metrics.agent.grafana.com/scrape: false
image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:2.11.0}
volumes:
- ../../../monitoring-mixins/crontab:/etc/crontabs/root
- ../../../monitoring-mixins/agent-flow-mixin/deploy/agent-flow-mixin-alerts.yaml:/rules/agent-flow-mixin-alerts.yaml
- ../../../monitoring-mixins/memcached-mixin/deploy/memcached-mixin-alerts.yaml:/rules/memcached-mixin-alerts.yaml
- ../../../monitoring-mixins/mimir-mixin/deploy/mimir-mixin-rules.yaml:/rules/mimir-mixin-rules.yaml
- ../../../monitoring-mixins/mimir-mixin/deploy/mimir-mixin-alerts.yaml:/rules/mimir-mixin-alerts.yaml
environment:
- MIMIR_ADDRESS=http://gateway:8080
- MIMIR_TENANT_ID=anonymous
entrypoint: crond -f
restart: always
59 changes: 50 additions & 9 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,56 @@

This directory contains examples, including:

- [github-exporter](./github-exporter/README.md)
- [github-exporter-with-mixin](./ghe-with-mixin)
- [github-exporter-with-simple-dashboards](./ghe-with-simple-dashboards)
- [github-exporter](./github-exporter)
- [grafana-oncall-integration](./grafana-oncall)

The following ports will be exposed on the host:
## Debug info

- Loki on <http://localhost:33100>
- Grafana on <http://localhost:3000>
- Grafana Agent on <http://localhost:12345>
- Tempo on <http://localhost:33200>
- Mimir on <http://localhost:38080>
- Pyroscope on <http://localhost:34040>
`grafana-agent` target scrape:

The Minio console is available at <http://localhost:9001>
<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>

## Grafana LGTMP Stack default port-mapping

| Port-mapping | Component | Description |
| --- | --- | --- |
| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container |
| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container |
| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container |
| `38080:8080` | [Mimir][5] | Expose `38080` port so we can directly access `mimir` inside container |
| `34040:4040` | [Pyroscope][6] | Expose `34040` port so we can directly access `pyroscope` inside container |
| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
| `39000:9000`, `2500`, `1100` | [Inbucket][8] | Expose `39000` port to use for the email testing server web interface. |

[1]: https://github.com/grafana/agent
[2]: https://github.com/grafana/loki
[3]: https://github.com/grafana/grafana
[4]: https://github.com/grafana/tempo
[5]: https://github.com/grafana/mimir
[6]: https://github.com/grafana/pyroscope
[7]: https://github.com/minio/minio
[8]: https://github.com/inbucket/inbucket

## Resource Utilization

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats
```

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

```
53 changes: 26 additions & 27 deletions examples/ghe-with-mixin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,38 @@ Exposes basic metrics for your repositories from the GitHub API, to a Prometheus

## Docker compose

`compose.yaml`:

```yaml
include:
# use git remote
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# use local path
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml

services:
github-exporter:
labels:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=qclaogui/codelab-monitoring
- REPOS=grafana/agent
```
`compose.override.yaml`:

```yaml
services:
# override included service grafana for dashboards pre-provisioning
grafana:
volumes:
- ../../monitoring-mixins/github-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/github-mixin
# override included service mimirtool for rules and alerts pre-provisioning
mimirtool:
volumes:
- ../../monitoring-mixins/github-mixin/deploy/github-mixin-rules.yaml:/rules/github-mixin-rules.yaml
- ../../monitoring-mixins/github-mixin/deploy/github-mixin-alerts.yaml:/rules/github-mixin-alerts.yaml
```

## Try it
Expand All @@ -22,37 +44,14 @@ services:
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
```

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
```

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.
Once all containers are up and running you can search for metrics in Grafana.

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

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

## Debug info(`grafana-agent` target scrape)

<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>

## Resource Utilization

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats
```
## Stop services

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

COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
```
7 changes: 4 additions & 3 deletions examples/ghe-with-mixin/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
include:
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# Local
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
# use git remote
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# use local path
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml

services:
github-exporter:
Expand Down
51 changes: 51 additions & 0 deletions examples/ghe-with-simple-dashboards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Prometheus GitHub Exporter

Exposes basic metrics for your repositories from the GitHub API, to a Prometheus compatible endpoint.

## Docker compose

`compose.yaml`:

```yaml
include:
# use git remote
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# use local path
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml

services:
github-exporter:
labels:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=grafana/agent
```
`compose.override.yaml`:

```yaml
services:
# override included service grafana for dashboards pre-provisioning
grafana:
volumes:
- ./dashboards:/var/lib/grafana/dashboards/github-mixin
```

## Try it

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
```

Once all containers are up and running you can search for metrics in Grafana.

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

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

## Stop services

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
```
7 changes: 4 additions & 3 deletions examples/ghe-with-simple-dashboards/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
include:
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# Local
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
# use git remote
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# use local path
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml

services:
github-exporter:
Expand Down
41 changes: 11 additions & 30 deletions examples/github-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ Exposes basic metrics for your repositories from the GitHub API, to a Prometheus

## Docker compose

```yaml
`compose.yaml`:

```yaml
include:
# use git remote
- path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml
# use local path
# - path: ../../docker-compose/monolithic-mode/logs/compose.yaml

# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/agent-flow/modules/docker/README.md
services:
github-exporter:
labels:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=qclaogui/codelab-monitoring

- REPOS=grafana/agent
```
## Try it
Expand All @@ -24,37 +28,14 @@ services:
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans
```

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
```

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.
Once all containers are up and running you can search for metrics in Grafana.

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

## Debug info(`grafana-agent` target scrape)

<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>

## Resource Utilization
## Stop services

```shell
COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats
```

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

COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose down
```
3 changes: 2 additions & 1 deletion examples/github-exporter/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
# include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later.
# docs: https://docs.docker.com/compose/multiple-compose-files/include/#include-and-overrides
include:
# use git remote
# - 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)
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/metrics/compose.yaml # Metrics
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/logs/compose.yaml # Metrics and Logs
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/traces/compose.yaml # Metrics and Traces
# - path: https://github.com/qclaogui/codelab-monitoring.git#main:docker-compose/monolithic-mode/profiles/compose.yaml # Metrics and Profiles

# Local
# use local path
- path: ../../docker-compose/monolithic-mode/logs/compose.yaml
# - path: ../../docker-compose/read-write-mode/logs/compose.yaml
# - path: ../../docker-compose/microservices-mode/logs/compose.yaml
Expand Down
Loading

0 comments on commit 0be2244

Please sign in to comment.