(self, metric, scraper_config)
The ready status of a cluster node. v1.0+
The ready status of a cluster node. v1.0+
The ready status of a cluster node . v1 . 0 +
def kube_node_status_condition(self, metric, scraper_config):
        """The ready status of a cluster node. v1.0+"""
        base_check_name = scraper_config['namespace'] + '.node'
        metric_name = scraper_config['namespace'] + '.nodes.by_condition'
        by_condition_counter = Counter()

        for sample in metric.samples:
            node_tags = self._label_to_tags("node", sample[self.SAMPLE_LABELS], scraper_config)
            self._condition_to_tag_check(
                sample,
                base_check_name,
                self.condition_to_status_positive,
                scraper_config,
                tags=node_tags + scraper_config['custom_tags'],
            )

            # Counts aggregated cluster-wide to avoid no-data issues on node churn,
            # node granularity available in the service checks
            tags = (
                self._label_to_tags("condition", sample[self.SAMPLE_LABELS], scraper_config)
                + self._label_to_tags("status", sample[self.SAMPLE_LABELS], scraper_config)
                + scraper_config['custom_tags']
            )
            by_condition_counter[tuple(sorted(tags))] += sample[self.SAMPLE_VALUE]

        for tags, count in iteritems(by_condition_counter):
            self.gauge(metric_name, count, tags=list(tags))
def kube_node_status_condition ( self , metric , scraper_config ) : base_check_name = scraper_config [ 'namespace' ] + '.node' metric_name = scraper_config [ 'namespace' ] + '.nodes.by_condition' by_condition_counter = Counter ( ) for sample in metric . samples : node_tags = self . _label_to_tags ( "node" , sample [ self . SAMPLE_LABELS ] , scraper_config ) self . _condition_to_tag_check ( sample , base_check_name , self . condition_to_status_positive , scraper_config , tags = node_tags + scraper_config [ 'custom_tags' ] , ) # Counts aggregated cluster-wide to avoid no-data issues on node churn, # node granularity available in the service checks tags = ( self . _label_to_tags ( "condition" , sample [ self . SAMPLE_LABELS ] , scraper_config ) + self . _label_to_tags ( "status" , sample [ self . SAMPLE_LABELS ] , scraper_config ) + scraper_config [ 'custom_tags' ] ) by_condition_counter [ tuple ( sorted ( tags ) ) ] += sample [ self . SAMPLE_VALUE ] for tags , count in iteritems ( by_condition_counter ) : self . gauge ( metric_name , count , tags = list ( tags ) )