!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/libexec/netdata/python.d/   drwxr-xr-x
Free 13.22 GB of 57.97 GB (22.8%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     dockerd.chart.py (2.65 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# -*- coding: utf-8 -*-
# Description: docker netdata python.d module
# Author: Kévin Darcel (@tuxity)

try:
    import docker

    HAS_DOCKER = True
except ImportError:
    HAS_DOCKER = False

from distutils.version import StrictVersion

from bases.FrameworkServices.SimpleService import SimpleService

# charts order (can be overridden if you want less charts, or different order)
ORDER = [
    'running_containers',
    'healthy_containers',
    'unhealthy_containers'
]

CHARTS = {
    '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', 'containers', 'healthy containers',
                    'docker.healthy_containers', 'line'],
        'lines': [
            ['healthy_containers', 'healthy']
        ]
    },
    'unhealthy_containers': {
        'options': [None, 'Number of unhealthy containers', 'containers', 'unhealthy containers',
                    'docker.unhealthy_containers', 'line'],
        'lines': [
            ['unhealthy_containers', 'unhealthy']
        ]
    }
}

MIN_REQUIRED_VERSION = '3.2.0'


class Service(SimpleService):
    def __init__(self, configuration=None, name=None):
        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 dockerd module")
            return False

        if StrictVersion(docker.__version__) < StrictVersion(MIN_REQUIRED_VERSION):
            self.error("installed 'docker' package version {0}, minimum required version {1}, please upgrade".format(
                docker.__version__,
                MIN_REQUIRED_VERSION,
            ))
            return False

        self.client = docker.DockerClient(base_url=self.configuration.get('url', 'unix://var/run/docker.sock'))

        try:
            self.client.ping()
        except docker.errors.APIError as error:
            self.error(error)
            return False

        return True

    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))

        return data or None

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0233 ]--