-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.monitoring.yml
More file actions
174 lines (162 loc) · 4.53 KB
/
docker-compose.monitoring.yml
File metadata and controls
174 lines (162 loc) · 4.53 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
version: '3.8'
services:
# Prometheus监控服务
prometheus:
image: prom/prometheus:latest
container_name: inner-cosmos-prometheus
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- ./monitoring/alert_rules.yml:/etc/prometheus/alert_rules.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=30d'
- '--web.enable-lifecycle'
- '--web.enable-admin-api'
restart: unless-stopped
networks:
- monitoring
# Grafana可视化服务
grafana:
image: grafana/grafana:latest
container_name: inner-cosmos-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin123}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana-dashboard.json:/etc/grafana/provisioning/dashboards/dashboard.json
restart: unless-stopped
networks:
- monitoring
# AlertManager告警管理
alertmanager:
image: prom/alertmanager:latest
container_name: inner-cosmos-alertmanager
ports:
- "9093:9093"
volumes:
- ./monitoring/alertmanager.yml:/etc/alertmanager/alertmanager.yml
- alertmanager_data:/alertmanager
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
- '--web.external-url=http://localhost:9093'
restart: unless-stopped
networks:
- monitoring
# Node Exporter系统监控
node-exporter:
image: prom/node-exporter:latest
container_name: inner-cosmos-node-exporter
ports:
- "9100:9100"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
restart: unless-stopped
networks:
- monitoring
# Redis Exporter
redis-exporter:
image: oliver006/redis_exporter:latest
container_name: inner-cosmos-redis-exporter
ports:
- "9121:9121"
environment:
- REDIS_ADDR=redis://redis:6379
- REDIS_PASSWORD=${REDIS_PASSWORD}
restart: unless-stopped
networks:
- monitoring
- inner-cosmos-network
# Nginx Exporter
nginx-exporter:
image: nginx/nginx-prometheus-exporter:latest
container_name: inner-cosmos-nginx-exporter
ports:
- "9113:9113"
command:
- '-nginx.scrape-uri=http://frontend:80/nginx_status'
restart: unless-stopped
networks:
- monitoring
- inner-cosmos-network
# cAdvisor容器监控
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: inner-cosmos-cadvisor
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
privileged: true
devices:
- /dev/kmsg
restart: unless-stopped
networks:
- monitoring
# Blackbox Exporter网站监控
blackbox-exporter:
image: prom/blackbox-exporter:latest
container_name: inner-cosmos-blackbox-exporter
ports:
- "9115:9115"
volumes:
- ./monitoring/blackbox.yml:/etc/blackbox_exporter/config.yml
restart: unless-stopped
networks:
- monitoring
# Loki日志聚合
loki:
image: grafana/loki:latest
container_name: inner-cosmos-loki
ports:
- "3100:3100"
volumes:
- loki_data:/loki
- ./monitoring/loki-config.yml:/etc/loki/local-config.yaml
command: -config.file=/etc/loki/local-config.yaml
restart: unless-stopped
networks:
- monitoring
# Promtail日志收集
promtail:
image: grafana/promtail:latest
container_name: inner-cosmos-promtail
volumes:
- /var/log:/var/log:ro
- ./logs:/app/logs:ro
- ./monitoring/promtail-config.yml:/etc/promtail/config.yml
command: -config.file=/etc/promtail/config.yml
restart: unless-stopped
networks:
- monitoring
volumes:
prometheus_data:
grafana_data:
alertmanager_data:
loki_data:
networks:
monitoring:
driver: bridge
inner-cosmos-network:
external: true