Whitespace changes
This commit is contained in:
parent
408e3d8ac9
commit
38ed83424c
@ -82,6 +82,7 @@ class jmx_query():
|
|||||||
url = self.get_url('hbase', hbase_active_master)
|
url = self.get_url('hbase', hbase_active_master)
|
||||||
self.get_jmx_data(url)
|
self.get_jmx_data(url)
|
||||||
|
|
||||||
|
|
||||||
def get_url(self, service, hostname):
|
def get_url(self, service, hostname):
|
||||||
if (namenode_use_tls):
|
if (namenode_use_tls):
|
||||||
url_scheme = "https://"
|
url_scheme = "https://"
|
||||||
@ -94,6 +95,7 @@ class jmx_query():
|
|||||||
url = url_scheme + hostname + ":" + str(hbase_master_ui_port) + "/jmx"
|
url = url_scheme + hostname + ":" + str(hbase_master_ui_port) + "/jmx"
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
def get_jmx_data(self, url):
|
def get_jmx_data(self, url):
|
||||||
jmx = self.query(url)
|
jmx = self.query(url)
|
||||||
|
|
||||||
@ -107,6 +109,7 @@ class jmx_query():
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def get_active_namenode(hdfs_namenode_hosts):
|
def get_active_namenode(hdfs_namenode_hosts):
|
||||||
|
|
||||||
if not which(cmd_hdfs_namenodes[0]):
|
if not which(cmd_hdfs_namenodes[0]):
|
||||||
@ -157,6 +160,7 @@ class jmx_query():
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def query(self, url):
|
def query(self, url):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -169,6 +173,7 @@ class jmx_query():
|
|||||||
jmx = flatten(jmx)
|
jmx = flatten(jmx)
|
||||||
return(jmx)
|
return(jmx)
|
||||||
|
|
||||||
|
|
||||||
def lookup_keys(self, key, value):
|
def lookup_keys(self, key, value):
|
||||||
if key.endswith("capacityUsed"):
|
if key.endswith("capacityUsed"):
|
||||||
prom_hdfs_used.set(value)
|
prom_hdfs_used.set(value)
|
||||||
@ -211,6 +216,7 @@ class hbase_exporter():
|
|||||||
self.hbck_get_inconsistencies()
|
self.hbck_get_inconsistencies()
|
||||||
self.check_health()
|
self.check_health()
|
||||||
|
|
||||||
|
|
||||||
def check_health():
|
def check_health():
|
||||||
if self.num_inconsistencies > 0:
|
if self.num_inconsistencies > 0:
|
||||||
prom_hbase_healthy.set(0)
|
prom_hbase_healthy.set(0)
|
||||||
@ -225,6 +231,7 @@ class hbase_exporter():
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_active_master():
|
def get_active_master():
|
||||||
|
|
||||||
@ -245,6 +252,7 @@ class hbase_exporter():
|
|||||||
prom_hbase_up.set(1)
|
prom_hbase_up.set(1)
|
||||||
return r.stdout.decode('utf-8')
|
return r.stdout.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
def get_stale_regions_in_transition(self, hbase_master):
|
def get_stale_regions_in_transition(self, hbase_master):
|
||||||
host = hbase_master.rstrip("\n\r")
|
host = hbase_master.rstrip("\n\r")
|
||||||
port = hbase_master_ui_port
|
port = hbase_master_ui_port
|
||||||
@ -280,6 +288,7 @@ class hbase_exporter():
|
|||||||
|
|
||||||
return num_regions_in_transition_stale
|
return num_regions_in_transition_stale
|
||||||
|
|
||||||
|
|
||||||
def hbaseui_parse_output(self, content):
|
def hbaseui_parse_output(self, content):
|
||||||
soup = BeautifulSoup(content, 'html.parser')
|
soup = BeautifulSoup(content, 'html.parser')
|
||||||
num_regions_in_transition_stale = 0
|
num_regions_in_transition_stale = 0
|
||||||
@ -300,6 +309,7 @@ class hbase_exporter():
|
|||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
logging.info('Failed to parse HBase Master UI status page')
|
logging.info('Failed to parse HBase Master UI status page')
|
||||||
|
|
||||||
|
|
||||||
def hbck_get_inconsistencies(self):
|
def hbck_get_inconsistencies(self):
|
||||||
re_status = re.compile(r'^Status:\s*(.+?)\s*$')
|
re_status = re.compile(r'^Status:\s*(.+?)\s*$')
|
||||||
re_inconsistencies = re.compile(r'^\s*(\d+)\s+inconsistencies\s+detected\.?\s*$')
|
re_inconsistencies = re.compile(r'^\s*(\d+)\s+inconsistencies\s+detected\.?\s*$')
|
||||||
@ -342,6 +352,7 @@ class hbase_exporter():
|
|||||||
|
|
||||||
self.num_inconsistencies = num_inconsistencies
|
self.num_inconsistencies = num_inconsistencies
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def hbaseui_parse_table(table):
|
def hbaseui_parse_table(table):
|
||||||
for row in table.findChildren('tr'):
|
for row in table.findChildren('tr'):
|
||||||
@ -352,6 +363,7 @@ class hbase_exporter():
|
|||||||
return num_regions_in_transition_stale
|
return num_regions_in_transition_stale
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def which(program):
|
def which(program):
|
||||||
|
|
||||||
def is_executable(fn):
|
def is_executable(fn):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user