jmx: Get hbase jmx data also when running w/o HDFS

This commit is contained in:
Björn Busse 2021-03-05 03:32:40 +01:00
parent 355327da3b
commit e838ccf359

View File

@ -84,7 +84,7 @@ cmd_hdfs_namenodes = ['hdfs', 'getconf', '-namenodes']
# Use command line arguments to set the following vars # Use command line arguments to set the following vars
# Do not change them here (See TODO) # Do not change them here (See TODO)
namenodes = "" namenodes = ""
namenode_use_tls = False jmx_use_tls = False
hbase_master_ui_default_port = 16010 hbase_master_ui_default_port = 16010
hdfs_namenode_default_port = 50070 hdfs_namenode_default_port = 50070
cluster_is_kerberized = False cluster_is_kerberized = False
@ -210,26 +210,31 @@ class jmx_query():
hdfs_active_namenode = self.active_namenode(hdfs_namenode_hosts) hdfs_active_namenode = self.active_namenode(hdfs_namenode_hosts)
hbase_active_master = hbase_exporter.zk_active_master() hbase_active_master = hbase_exporter.zk_active_master()
hdfs_jmx = True
hbase_jmx = True
if not hdfs_active_namenode: if not hdfs_active_namenode:
logging.info("Failed to determine active HDFS namenode") logging.info("Failed to determine active HDFS namenode")
return False hdfs_jmx = False
if not hbase_active_master: if not hbase_active_master:
logging.info("Failed to determine active HBase master") logging.info("Failed to determine active HBase master")
return False hbase_jmx = False
url = self.get_url('hdfs', hdfs_active_namenode) if hdfs_jmx:
logging.info("hdfs: Fetching jmx data") url = self.get_url('hdfs', hdfs_active_namenode)
self.jmx_data(url) logging.info("hdfs: Fetching jmx data")
url = self.get_url('hbase', hbase_active_master) self.jmx_data(url)
logging.info("hbase: Fetching jmx data")
self.jmx_data(url) if hbase_jmx:
url = self.get_url('hbase', hbase_active_master)
logging.info("hbase: Fetching jmx data")
self.jmx_data(url)
def get_url(self, service, hostname): def get_url(self, service, hostname):
if (namenode_use_tls): if (jmx_use_tls):
url_scheme = "https://" url_scheme = "https://"
else: else:
url_scheme = "http://" url_scheme = "http://"