This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cd8aa8
commit 5c96924
Showing
5 changed files
with
30 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# yaml-language-server: $schema=https://json.schemastore.org/prometheus.json | ||
# | ||
# Scrape config for Docker Swarm Nodes | ||
# | ||
# The Docker Engine metrics are required to be configured in the daemon.json file for Prometheus to scrape them. | ||
# This configuration also includes a job to scrape the Node Exporter metrics that run on each node. | ||
scrape_configs: | ||
- job_name: 'echo-scrape-config' | ||
|
||
static_configs: | ||
- targets: | ||
- 'localhost:80' | ||
labels: | ||
app: 'echo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,294 +1,22 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/swarmlibs/dockerstack-schema/main/schema/dockerstack-spec.json | ||
|
||
x-default-logging: &x-default-logging | ||
options: | ||
max-size: "12m" | ||
max-file: "5" | ||
driver: json-file | ||
|
||
x-exporter-resources-constraints: &x-exporter-resources-constraints | ||
limits: | ||
memory: 128M | ||
reservations: | ||
memory: 64M | ||
|
||
volumes: | ||
alertmanager-data: | ||
alertmanager-configs: | ||
|
||
prometheus-data: | ||
prometheus-configs: | ||
|
||
networks: | ||
dockerswarm_ingress: | ||
name: dockerswarm_ingress | ||
external: true | ||
dockerswarm_metrics: | ||
name: dockerswarm_metrics | ||
external: true | ||
prometheus_exporters: | ||
name: prometheus_exporters | ||
external: true | ||
|
||
services: | ||
|
||
# ==================================================== | ||
# Prometheus | ||
# https://github.com/prometheus/prometheus | ||
# ==================================================== | ||
|
||
prometheus: | ||
image: swarmlibs/prometheus:local | ||
deploy: | ||
mode: global | ||
placement: | ||
max_replicas_per_node: 1 | ||
constraints: | ||
- node.role == manager | ||
labels: | ||
io.prometheus.role: "prometheus" | ||
io.prometheus.dockerswarm-tasks.should_be_scraped: "false" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
environment: | ||
- DOCKERSWARM_SERVICE_ID={{.Service.ID}} | ||
- DOCKERSWARM_SERVICE_NAME={{.Service.Name}} | ||
- DOCKERSWARM_NODE_ID={{.Node.ID}} | ||
- DOCKERSWARM_NODE_HOSTNAME={{.Node.Hostname}} | ||
- DOCKERSWARM_TASK_ID={{.Task.ID}} | ||
- DOCKERSWARM_TASK_NAME={{.Task.Name}} | ||
- DOCKERSWARM_TASK_SLOT={{.Task.Slot}} | ||
- DOCKERSWARM_STACK_NAMESPACE={{ index .Service.Labels "com.docker.stack.namespace"}} | ||
|
||
# Cluster Alertmanager address | ||
- PROMETHEUS_ALERTMANAGER_ADDR=tasks.alertmanager | ||
ports: | ||
- published: 9090 | ||
target: 9090 | ||
mode: host | ||
hostname: prometheus.svc.cluster.local | ||
networks: | ||
dockerswarm_ingress: | ||
dockerswarm_metrics: | ||
prometheus_exporters: | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
volumes: | ||
- type: bind | ||
source: /var/run/docker.sock | ||
target: /var/run/docker.sock | ||
read_only: true | ||
- type: volume | ||
source: prometheus-data | ||
target: /prometheus/data | ||
- type: volume | ||
source: prometheus-configs | ||
target: /prometheus-configs.d | ||
|
||
prometheus-config-reloader: | ||
image: quay.io/prometheus-operator/prometheus-config-reloader:v0.74.0 | ||
command: | ||
- --listen-address=:8080 | ||
- --watched-dir=/prometheus-configs.d | ||
- --reload-url=http://host.docker.internal:9090/-/reload | ||
- --runtimeinfo-url=http://host.docker.internal:9090/api/v1/status/runtimeinfo | ||
- --watch-interval=15s | ||
- --reload-timeout=10s | ||
deploy: | ||
mode: global | ||
resources: *x-exporter-resources-constraints | ||
placement: | ||
max_replicas_per_node: 1 | ||
constraints: | ||
- node.role == manager | ||
labels: | ||
io.prometheus.role: "prometheus-config-reloader" | ||
io.prometheus.enabled: "true" | ||
io.prometheus.job_name: "prometheus-config-reloader" | ||
io.prometheus.scrape_port: "8080" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
networks: | ||
dockerswarm_metrics: | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
volumes: | ||
- type: volume | ||
source: prometheus-configs | ||
target: /prometheus-configs.d | ||
|
||
# ==================================================== | ||
# Alertmanager | ||
# https://github.com/prometheus/alertmanager | ||
# ==================================================== | ||
|
||
alertmanager: | ||
image: swarmlibs/alertmanager:main | ||
deploy: | ||
mode: global | ||
placement: | ||
max_replicas_per_node: 1 | ||
constraints: | ||
- node.role == manager | ||
labels: | ||
io.prometheus.role: "alertmanager" | ||
io.prometheus.dockerswarm-tasks.should_be_scraped: "false" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
environment: | ||
- DOCKERSWARM_SERVICE_ID={{.Service.ID}} | ||
- DOCKERSWARM_SERVICE_NAME={{.Service.Name}} | ||
- DOCKERSWARM_NODE_ID={{.Node.ID}} | ||
- DOCKERSWARM_NODE_HOSTNAME={{.Node.Hostname}} | ||
- DOCKERSWARM_TASK_ID={{.Task.ID}} | ||
- DOCKERSWARM_TASK_NAME={{.Task.Name}} | ||
- DOCKERSWARM_TASK_SLOT={{.Task.Slot}} | ||
- DOCKERSWARM_STACK_NAMESPACE={{ index .Service.Labels "com.docker.stack.namespace"}} | ||
echo-server: | ||
image: ealen/echo-server:latest | ||
ports: | ||
- published: 9093 | ||
target: 9093 | ||
- published: 18080 | ||
target: 80 | ||
mode: host | ||
hostname: alertmanager.{{.Node.ID}}.cluster.local | ||
networks: | ||
dockerswarm_metrics: | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
volumes: | ||
- type: volume | ||
source: alertmanager-data | ||
target: /alertmanager | ||
network_01: | ||
network_02: | ||
|
||
alertmanager-config-reloader: | ||
image: quay.io/prometheus-operator/prometheus-config-reloader:v0.74.0 | ||
command: | ||
- --listen-address=:8080 | ||
- --watched-dir=/alertmanager-configs.d | ||
- --reload-url=http://host.docker.internal:9093/-/reload | ||
deploy: | ||
mode: global | ||
resources: *x-exporter-resources-constraints | ||
placement: | ||
max_replicas_per_node: 1 | ||
constraints: | ||
- node.role == manager | ||
labels: | ||
io.prometheus.role: "alertmanager-config-reloader" | ||
io.prometheus.enabled: "true" | ||
io.prometheus.job_name: "alertmanager-config-reloader" | ||
io.prometheus.scrape_port: "8080" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
networks: | ||
dockerswarm_metrics: | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
volumes: | ||
- type: volume | ||
source: alertmanager-configs | ||
target: /alertmanager-configs.d | ||
|
||
# ==================================================== | ||
# Blackbox prober exporter | ||
# https://github.com/prometheus/blackbox_exporter | ||
# ==================================================== | ||
|
||
blackbox-exporter: | ||
image: prom/blackbox-exporter:latest | ||
deploy: | ||
replicas: 1 | ||
resources: *x-exporter-resources-constraints | ||
labels: | ||
io.prometheus.role: "blackbox-exporter" | ||
io.prometheus.enabled: "true" | ||
io.prometheus.job_name: "blackbox-exporter" | ||
io.prometheus.scrape_port: "9115" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
hostname: blackbox-exporter.svc.cluster.local | ||
networks: | ||
dockerswarm_ingress: | ||
dockerswarm_metrics: | ||
prometheus_exporters: | ||
|
||
# ==================================================== | ||
# Node exporter | ||
# https://github.com/prometheus/node_exporter | ||
# ==================================================== | ||
|
||
node-exporter: | ||
image: swarmlibs/node-exporter:main | ||
deploy: | ||
mode: global | ||
resources: *x-exporter-resources-constraints | ||
labels: | ||
io.prometheus.role: "node-exporter" | ||
io.prometheus.dockerswarm-tasks.should_be_scraped: "false" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
ports: | ||
- published: 9100 | ||
target: 9100 | ||
mode: host | ||
networks: | ||
prometheus_exporters: | ||
hostname: node-exporter.{{.Node.ID}}.cluster.local | ||
volumes: | ||
- type: bind | ||
source: / | ||
target: /rootfs | ||
read_only: true | ||
|
||
# ==================================================== | ||
# cAdvisor | ||
# https://github.com/google/cadvisor | ||
# ==================================================== | ||
|
||
cadvisor: | ||
image: gcr.io/cadvisor/cadvisor:v0.47.0 | ||
command: -logtostderr -docker_only | ||
deploy: | ||
mode: global | ||
resources: *x-exporter-resources-constraints | ||
labels: | ||
io.prometheus.role: "cadvisor" | ||
io.prometheus.dockerswarm-tasks.should_be_scraped: "false" | ||
io.prometheus.dockerswarm-services.should_be_probed: "false" | ||
logging: *x-default-logging | ||
ports: | ||
- published: 8080 | ||
target: 8080 | ||
mode: host | ||
networks: | ||
prometheus_exporters: | ||
hostname: cadvisor.{{.Node.ID}}.cluster.local | ||
volumes: | ||
- type: bind | ||
source: / | ||
target: /rootfs | ||
read_only: true | ||
- type: bind | ||
source: /var/run | ||
target: /var/run | ||
read_only: true | ||
- type: bind | ||
source: /sys | ||
target: /sys | ||
read_only: true | ||
- type: bind | ||
source: /var/lib/docker | ||
target: /var/lib/docker | ||
read_only: true | ||
- type: bind | ||
source: /var/run/docker.sock | ||
target: /var/run/docker.sock | ||
read_only: true | ||
# If you are running Docker Desktop on macOS, | ||
# You'll need to comment out the following bind mounts | ||
# - type: bind | ||
# source: /dev/disk | ||
# target: /dev/disk | ||
# read_only: true | ||
# - type: bind | ||
# source: /dev/kmsg | ||
# target: /dev/kmsg | ||
# read_only: true | ||
networks: | ||
network_01: | ||
network_02: | ||
|
||
configs: | ||
echo-scrape-config.yml: | ||
file: test/configs/echo-scrape-config.yml | ||
labels: | ||
- "io.prometheus.scrape_config=true" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.