(self, metric, scraper_config)
Whether a node can schedule new pods.
Whether a node can schedule new pods.
Whether a node can schedule new pods .
def kube_node_spec_unschedulable(self, metric, scraper_config):
        """Whether a node can schedule new pods."""
        metric_name = scraper_config['namespace'] + '.node.status'
        statuses = ('schedulable', 'unschedulable')
        if metric.type in METRIC_TYPES:
            for sample in metric.samples:
                tags = []
                for label_name, label_value in iteritems(sample[self.SAMPLE_LABELS]):
                    tags += self._build_tags(label_name, label_value, scraper_config)
                tags += scraper_config['custom_tags']
                status = statuses[int(sample[self.SAMPLE_VALUE])]  # value can be 0 or 1
                tags += self._build_tags('status', status, scraper_config)
                self.gauge(metric_name, 1, tags)  # metric value is always one, value is on the tags
        else:
            self.log.error("Metric type %s unsupported for metric %s", metric.type, metric.name)
def kube_node_spec_unschedulable ( self , metric , scraper_config ) : metric_name = scraper_config [ 'namespace' ] + '.node.status' statuses = ( 'schedulable' , 'unschedulable' ) if metric . type in METRIC_TYPES : for sample in metric . samples : tags = [ ] for label_name , label_value in iteritems ( sample [ self . SAMPLE_LABELS ] ) : tags += self . _build_tags ( label_name , label_value , scraper_config ) tags += scraper_config [ 'custom_tags' ] status = statuses [ int ( sample [ self . SAMPLE_VALUE ] ) ] # value can be 0 or 1 tags += self . _build_tags ( 'status' , status , scraper_config ) self . gauge ( metric_name , 1 , tags ) # metric value is always one, value is on the tags else : self . log . error ( "Metric type %s unsupported for metric %s" , metric . type , metric . name )