Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3755019
D2603.id6569.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2603.id6569.diff
View Options
diff --git a/_modules/paas_docker.py b/_modules/paas_docker.py
--- a/_modules/paas_docker.py
+++ b/_modules/paas_docker.py
@@ -50,6 +50,29 @@
return subnets
+def _get_containers():
+ return __pillar__["docker_containers"][__grains__["id"]]
+
+
+def list_containers():
+ """
+ A function to list all the containers provisionned on a Docker engine.
+
+ This function uses the pillar docker_containers as authoritative source,
+ so it documents the expected configuration, not the actual containers
+ running. That allows to compare both states.
+
+ CLI Example:
+
+ salt * paas_docker.list_containers
+ """
+ return [
+ key
+ for service, service_containers in _get_containers().items()
+ for key in service_containers.keys()
+ ]
+
+
# -------------------------------------------------------------
# Monitoring
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -71,7 +94,7 @@
salt * paas_docker.get_health_checks
"""
- containers = __pillar__["docker_containers"][__grains__["id"]]
+ containers = _get_containers()
monitoring = __pillar__["docker_containers_monitoring"]
return {
diff --git a/roles/paas-docker/monitoring/init.sls b/roles/paas-docker/monitoring/init.sls
--- a/roles/paas-docker/monitoring/init.sls
+++ b/roles/paas-docker/monitoring/init.sls
@@ -27,3 +27,4 @@
- context:
checks:
- {{ salt['paas_docker.get_health_checks']() }}
+ - check_docker_containers: {{ salt['paas_docker.list_containers']() }}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 11:54 (21 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2252357
Default Alt Text
D2603.id6569.diff (1 KB)
Attached To
Mode
D2603: Configure Docker containers checks
Attached
Detach File
Event Timeline
Log In to Comment