Skip to content

Commit ee153a1

Browse files
committed
Fix docker exception catching, rename total config option
1 parent 2db7226 commit ee153a1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

checks.d/docker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def check(self, instance):
143143

144144
try:
145145
containers = self._get_containers(instance)
146-
except:
146+
except socket.timeout:
147147
raise Exception('Cannot get containers list: timeout during socket connection. Try to refine the containers to collect by editing the configuration file.')
148148

149149
if not containers:
@@ -184,7 +184,7 @@ def check(self, instance):
184184
stat_file = os.path.join(mountpoint, metric["file"] % (self.path_prefix, container["Id"]))
185185
stats = self._parse_cgroup_file(stat_file)
186186
for key, (dd_key, metric_type) in metric["metrics"].items():
187-
if key.startswith("total_") and not instance.get("total"):
187+
if key.startswith("total_") and not instance.get("collect_total"):
188188
continue
189189
if key in stats:
190190
getattr(self, metric_type)(dd_key, int(stats[key]), tags=container_tags)

conf.d/docker.yaml.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ instances:
3333

3434
# Sub-cgroups metrics
3535
#
36-
# If you want to include sub-cgroups metrics, turn the total option on.
36+
# If you want to include sub-cgroups metrics, turn the collect_total option on.
3737
# It is useless for a normal usage, as total_ metrics will be the same as normal ones.
3838
#
3939
# Example:
4040
# instances:
4141
# - url: "unix://var/run/docker.sock"
42-
# total: true
42+
# collect_total: true

0 commit comments

Comments
 (0)