diff options
Diffstat (limited to 'collectors/python.d.plugin/dockerd/dockerd.chart.py')
-rw-r--r-- | collectors/python.d.plugin/dockerd/dockerd.chart.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/collectors/python.d.plugin/dockerd/dockerd.chart.py b/collectors/python.d.plugin/dockerd/dockerd.chart.py index dd3bae125a..d372c6a16b 100644 --- a/collectors/python.d.plugin/dockerd/dockerd.chart.py +++ b/collectors/python.d.plugin/dockerd/dockerd.chart.py @@ -23,21 +23,21 @@ ORDER = [ CHARTS = { 'running_containers': { - 'options': [None, 'Number of running containers', 'running containers', 'running containers', + 'options': [None, 'Number of running containers', 'containers', 'running containers', 'docker.running_containers', 'line'], 'lines': [ ['running_containers', 'running'] ] }, 'healthy_containers': { - 'options': [None, 'Number of healthy containers', 'healthy containers', 'healthy containers', + 'options': [None, 'Number of healthy containers', 'containers', 'healthy containers', 'docker.healthy_containers', 'line'], 'lines': [ ['healthy_containers', 'healthy'] ] }, 'unhealthy_containers': { - 'options': [None, 'Number of unhealthy containers', 'unhealthy containers', 'unhealthy containers', + 'options': [None, 'Number of unhealthy containers', 'containers', 'unhealthy containers', 'docker.unhealthy_containers', 'line'], 'lines': [ ['unhealthy_containers', 'unhealthy'] @@ -51,10 +51,11 @@ class Service(SimpleService): SimpleService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS + self.client = None def check(self): if not HAS_DOCKER: - self.error('\'docker\' package is needed to use docker.chart.py') + self.error("'docker' package is needed to use docker.chart.py") return False self.client = docker.DockerClient(base_url=self.configuration.get('url', 'unix://var/run/docker.sock')) @@ -69,6 +70,7 @@ class Service(SimpleService): def get_data(self): data = dict() + data['running_containers'] = len(self.client.containers.list(sparse=True)) data['healthy_containers'] = len(self.client.containers.list(filters={'health': 'healthy'}, sparse=True)) data['unhealthy_containers'] = len(self.client.containers.list(filters={'health': 'unhealthy'}, sparse=True)) |