Example #1
0
    def check(self, instance):
        kube_settings = get_kube_settings()
        if not kube_settings.get("host"):
            raise Exception(
                'Unable to get default router and host parameter is not set')

        self.max_depth = instance.get('max_depth', DEFAULT_MAX_DEPTH)
        enabled_gauges = instance.get('enabled_gauges', DEFAULT_ENABLED_GAUGES)
        self.enabled_gauges = [
            "{0}.{1}".format(NAMESPACE, x) for x in enabled_gauges
        ]
        enabled_rates = instance.get('enabled_rates', DEFAULT_ENABLED_RATES)
        self.enabled_rates = [
            "{0}.{1}".format(NAMESPACE, x) for x in enabled_rates
        ]

        self.publish_aliases = _is_affirmative(
            instance.get('publish_aliases', DEFAULT_PUBLISH_ALIASES))
        self.use_histogram = _is_affirmative(
            instance.get('use_histogram', DEFAULT_USE_HISTOGRAM))
        self.publish_rate = FUNC_MAP[RATE][self.use_histogram]
        self.publish_gauge = FUNC_MAP[GAUGE][self.use_histogram]

        # master health checks
        if instance.get('enable_master_checks', False):
            master_url = kube_settings["master_url_nodes"]
            self._perform_master_checks(master_url)

        # kubelet health checks
        if instance.get('enable_kubelet_checks', True):
            kube_health_url = kube_settings["kube_health_url"]
            self._perform_kubelet_checks(kube_health_url)

        # kubelet metrics
        self._update_metrics(instance, kube_settings)
Example #2
0
    def check(self, instance):
        kube_settings = get_kube_settings()
        if not kube_settings.get("host"):
            raise Exception('Unable to get default router and host parameter is not set')

        self.max_depth = instance.get('max_depth', DEFAULT_MAX_DEPTH)
        enabled_gauges = instance.get('enabled_gauges', DEFAULT_ENABLED_GAUGES)
        self.enabled_gauges = ["{0}.{1}".format(NAMESPACE, x) for x in enabled_gauges]
        enabled_rates = instance.get('enabled_rates', DEFAULT_ENABLED_RATES)
        self.enabled_rates = ["{0}.{1}".format(NAMESPACE, x) for x in enabled_rates]

        self.publish_aliases = _is_affirmative(instance.get('publish_aliases', DEFAULT_PUBLISH_ALIASES))
        self.use_histogram = _is_affirmative(instance.get('use_histogram', DEFAULT_USE_HISTOGRAM))
        self.publish_rate = FUNC_MAP[RATE][self.use_histogram]
        self.publish_gauge = FUNC_MAP[GAUGE][self.use_histogram]

        # master health checks
        if instance.get('enable_master_checks', False):
            master_url = kube_settings["master_url_nodes"]
            self._perform_master_checks(master_url)

        # kubelet health checks
        if instance.get('enable_kubelet_checks', True):
            kube_health_url = kube_settings["kube_health_url"]
            self._perform_kubelet_checks(kube_health_url)

        # kubelet metrics
        self._update_metrics(instance, kube_settings)
Example #3
0
 def _retrieve_pods_list(self):
     kube_settings = get_kube_settings()
     return retrieve_json(kube_settings["pods_list_url"])
Example #4
0
 def _retrieve_pods_list(self):
     kube_settings = get_kube_settings()
     return retrieve_json(kube_settings["pods_list_url"])