-
Notifications
You must be signed in to change notification settings - Fork 16
/
docker-compose.monitoring.yml
142 lines (134 loc) · 4.08 KB
/
docker-compose.monitoring.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# define virtual network to give fixed IP for loki used by the logging-driver for all containers
networks:
vpcbr: # virtual network name
driver: bridge
ipam:
config: # here, we define our ip space
- subnet: 10.5.0.0/24
gateway: 10.5.0.1
# this is a YAML anchor to avoid repetition
x-logging: &logging
logging:
driver: loki
options: # note: the ip is the ip we will assign later to loki in this file
loki-url: "http://10.5.0.2:3100/loki/api/v1/push"
mode: non-blocking
max-buffer-size: 4m
loki-retries: "3"
max-size: "10m"
max-file: 1
services:
# The Loki database for storing logs.
loki:
<<: *logging
container_name: loki
image: grafana/loki:2.4.1
restart: always
command: -config.file=/etc/loki/loki-config.yml
volumes:
- loki-data:/loki
- ./loki/loki-config.yml:/etc/loki/loki-config.yml
networks:
vpcbr: # this is the place where we assign the static ipv4 address
ipv4_address: 10.5.0.2
default:
# mqtt_metrics_collector, listens to mqtt-broker
mqtt_metrics_collector:
<<: *logging
container_name: mqtt_metrics_collector
restart: unless-stopped
env_file:
- wis2box.env
#image: ghcr.io/wmo-im/wis2box-mqtt-metrics-collector:latest
build:
context: ./wis2box-mqtt-metrics-collector
depends_on:
- mosquitto
- wis2box-management
ports:
- 8001:8001
# prometheus to collect metrics
prometheus:
<<: *logging
image: prom/prometheus:v2.37.0
container_name: prometheus
restart: always
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.retention.time=10d'
- '--log.level=warn'
# uncomment cadvisor to monitor containers
# cadvisor:
# image: gcr.io/cadvisor/cadvisor:v0.45.0
# container_name: cadvisor
# volumes:
# - /:/rootfs:ro
# - /var/run:/var/run:ro
# - /var/run/docker.sock:/var/run/docker.sock:ro
# - /sys:/sys:ro
# - /var/lib/docker/:/var/lib/docker:ro
# - /dev/disk:/dev/disk/:ro
# depends_on:
# - wis2box-management
# Grafana, graphical monitoring dashboards for wis2box using data from loki and prometheus
grafana:
<<: *logging
container_name: grafana
restart: always
env_file:
- wis2box.env
image: grafana/grafana-oss:9.0.3
volumes:
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
- ./grafana/datasources:/etc/grafana/provisioning/datasources
# if alert want to link emails this place should mount local cofiguration to grafana
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_HIDE_VERSION=true
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/home.json
- GF_ANALYTICS_CHECK_FOR_UPDATES=false
- GF_USERS_VIEWERS_CAN_EDIT=true
- GF_UNIFIED_ALERTING_ENABLED=false
- GF_ALERTING_ENABLED=true
- GF_USERS_DEFAULT_THEME=dark
- GF_DISABLE_SIGNOUT_MENU=true
- GF_SERVER_ROOT_URL=${WIS2BOX_URL:-http://localhost}/monitoring
- GF_SERVER_SERVE_FROM_SUB_PATH=true
- GF_USAGE_STATS_ENABLED=false
- GF_LOG_LEVEL=warn
ports:
- 3000:3000
# Elasticsearch Exporter for monitoring Elasticsearch metrics
elasticsearch-exporter:
<<: *logging
container_name: elasticsearch-exporter
image: quay.io/prometheuscommunity/elasticsearch-exporter:latest
command:
- '--es.uri=http://elasticsearch:9200'
- '--es.indices_settings'
restart: always
elasticsearch:
<<: *logging
wis2box-management:
<<: *logging
mosquitto:
<<: *logging
wis2box-api:
<<: *logging
wis2box-auth:
<<: *logging
minio:
<<: *logging
web-proxy:
<<: *logging
wis2downloader:
<<: *logging
volumes:
loki-data:
prometheus-data: