INNER CODE UNIT · Python
collector_up_gauge
braedon/prometheus-es-exporter · prometheus_es_exporter/__init__.py:38
def collector_up_gauge(name_list, description, succeeded=True):
metric_name = format_metric_name(*name_list, 'up')
description = 'Did the {} fetch succeed.'.format(description)
return GaugeMetricFamily(metric_name, description, value=int(succeeded))
class ClusterHealthCollector(object):
def __init__(self, es_client, timeout, level):
self.metric_name_list = ['es', 'cluster_health']
self.description = 'Cluster Health'
self.es_client = es_client
self.timeout = timeout
self.level = level
def collect(self):
try:
response = self.es_client.cluster.health(level=self.level, request_timeout=self.timeout)