Beispiel #1
0
    def check(self, instance):
        """Run the Docker check for one instance."""
        if not self.init_success:
            # Initialization can fail if cgroups are not ready. So we retry if needed
            # https://github.com/DataDog/dd-agent/issues/1896
            self.init()
            if not self.init_success:
                # Initialization failed, will try later
                return

        # Report image metrics
        if self.collect_image_stats:
            self._count_and_weigh_images()

        if self.collect_ecs_tags:
            self.refresh_ecs_tags()

        if self.is_k8s():
            self.kube_labels = get_kube_labels()

        # Get the list of containers and the index of their names
        containers_by_id = self._get_and_count_containers()
        containers_by_id = self._crawl_container_pids(containers_by_id)

        # Report performance container metrics (cpu, mem, net, io)
        self._report_performance_metrics(containers_by_id)

        if self.collect_container_size:
            self._report_container_size(containers_by_id)

        # Send events from Docker API
        if self.collect_events:
            self._process_events(containers_by_id)
Beispiel #2
0
    def check(self, instance):
        """Run the Docker check for one instance."""
        if not self.init_success:
            # Initialization can fail if cgroups are not ready. So we retry if needed
            # https://github.com/DataDog/dd-agent/issues/1896
            self.init()
            if not self.init_success:
                # Initialization failed, will try later
                return

        # Report image metrics
        if self.collect_image_stats:
            self._count_and_weigh_images()

        if self.collect_ecs_tags:
            self.refresh_ecs_tags()

        if self.is_k8s():
            self.kube_labels = get_kube_labels()

        # Get the list of containers and the index of their names
        containers_by_id = self._get_and_count_containers()
        containers_by_id = self._crawl_container_pids(containers_by_id)

        # Report performance container metrics (cpu, mem, net, io)
        self._report_performance_metrics(containers_by_id)

        if self.collect_container_size:
            self._report_container_size(containers_by_id)

        # Send events from Docker API
        if self.collect_events:
            self._process_events(containers_by_id)
Beispiel #3
0
 def _retrieve_kube_labels(self):
     return get_kube_labels()
Beispiel #4
0
 def _retrieve_kube_labels(self):
     return get_kube_labels()