start: group Docker containers by compose project (collapsible stacks with running count, health dot, CPU/mem); collector captures compose labels
All checks were successful
Deploy production / deploy (push) Successful in 1m7s
All checks were successful
Deploy production / deploy (push) Successful in 1m7s
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
Runs every minute as a systemd user timer on the server (home-collector.timer) and upserts
|
||||
two rows into home.snapshots with the limited `home_collector` role:
|
||||
host CPU, RAM, swap, disk, load, uptime, Docker containers (state, health, restarts,
|
||||
CPU/mem), systemd timer results (backups, disk-guard, scrapers) and service checks
|
||||
CPU/mem, compose project/service), systemd timer results (backups, disk-guard, scrapers) and service checks
|
||||
ntfy the most recent messages from the owner's ntfy topics
|
||||
|
||||
The app container has no Docker socket and never gets one; this script uses the host's
|
||||
@@ -154,6 +154,7 @@ def containers():
|
||||
for c in info:
|
||||
st = c.get('State', {})
|
||||
name = c.get('Name', '').lstrip('/')
|
||||
labels = c.get('Config', {}).get('Labels') or {}
|
||||
out.append({
|
||||
'name': name,
|
||||
'image': c.get('Config', {}).get('Image', '').split('@')[0][:80],
|
||||
@@ -164,6 +165,9 @@ def containers():
|
||||
'startedAt': st.get('StartedAt'),
|
||||
'cpu': stats.get(name, {}).get('cpu'),
|
||||
'mem': stats.get(name, {}).get('mem'),
|
||||
# Compose project/service, so /start can group containers by stack.
|
||||
'project': labels.get('com.docker.compose.project'),
|
||||
'service': labels.get('com.docker.compose.service'),
|
||||
})
|
||||
out.sort(key=lambda c: c['name'])
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user