(self, sample, base_sc_name, mapping, scraper_config, tags=None)
Metrics from kube-state-metrics have changed
        For example:
        kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
        kube_node_status_condition{condition="OutOfDisk",node="ip-172-33-57-130.eu-west-1.compute",status="false"} 1
        metric {
          label { name: "condition", value: "true"
          }
          # other labels here
          gauge { value: 1.0 }
        }

        This function evaluates metrics containing conditions and sends a service check
        based on a provided condition->check mapping dict
Metrics from kube-state-metrics have changed
        For example:
        kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
        kube_node_status_condition{condition="OutOfDisk",node="ip-172-33-57-130.eu-west-1.compute",status="false"} 1
        metric {
          label { name: "condition", value: "true"
          }
          # other labels here
          gauge { value: 1.0 }
        }
Metrics from kube - state - metrics have changed For example : kube_node_status_condition { condition = Ready node = ip - 172 - 33 - 39 - 189 . eu - west - 1 . compute status = true } 1 kube_node_status_condition { condition = OutOfDisk node = ip - 172 - 33 - 57 - 130 . eu - west - 1 . compute status = false } 1 metric { label { name : condition value : true } # other labels here gauge { value : 1 . 0 } }
def _condition_to_tag_check(self, sample, base_sc_name, mapping, scraper_config, tags=None):
        """
        Metrics from kube-state-metrics have changed
        For example:
        kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
        kube_node_status_condition{condition="OutOfDisk",node="ip-172-33-57-130.eu-west-1.compute",status="false"} 1
        metric {
          label { name: "condition", value: "true"
          }
          # other labels here
          gauge { value: 1.0 }
        }

        This function evaluates metrics containing conditions and sends a service check
        based on a provided condition->check mapping dict
        """
        if bool(sample[self.SAMPLE_VALUE]) is False:
            return  # Ignore if gauge is not 1 and we are not processing the pod phase check

        metric_name = scraper_config['namespace'] + '.node.by_condition'
        metric_tags = []
        for label_name, label_value in iteritems(sample[self.SAMPLE_LABELS]):
            metric_tags += self._build_tags(label_name, label_value, scraper_config)
        self.gauge(
            metric_name,
            sample[self.SAMPLE_VALUE],
            tags=tags + metric_tags,
            hostname=self.get_hostname_for_sample(sample, scraper_config),
        )

        label_value, condition_map = self._get_metric_condition_map(base_sc_name, sample[self.SAMPLE_LABELS])
        service_check_name = condition_map['service_check_name']
        mapping = condition_map['mapping']

        if condition_map['service_check_name'] is None:
            self.log.debug("Unable to handle %s - unknown condition %s", service_check_name, label_value)
        else:
            self.service_check(service_check_name, mapping[label_value], tags=tags)
def _condition_to_tag_check ( self , sample , base_sc_name , mapping , scraper_config , tags = None ) : if bool ( sample [ self . SAMPLE_VALUE ] ) is False : return # Ignore if gauge is not 1 and we are not processing the pod phase check metric_name = scraper_config [ 'namespace' ] + '.node.by_condition' metric_tags = [ ] for label_name , label_value in iteritems ( sample [ self . SAMPLE_LABELS ] ) : metric_tags += self . _build_tags ( label_name , label_value , scraper_config ) self . gauge ( metric_name , sample [ self . SAMPLE_VALUE ] , tags = tags + metric_tags , hostname = self . get_hostname_for_sample ( sample , scraper_config ) , ) label_value , condition_map = self . _get_metric_condition_map ( base_sc_name , sample [ self . SAMPLE_LABELS ] ) service_check_name = condition_map [ 'service_check_name' ] mapping = condition_map [ 'mapping' ] if condition_map [ 'service_check_name' ] is None : self . log . debug ( "Unable to handle %s - unknown condition %s" , service_check_name , label_value ) else : self . service_check ( service_check_name , mapping [ label_value ] , tags = tags )