def get_collector_config(configurations): solr_metrics_props = "{0}/{1}".format(configurations[SOLR_METRICS_CONF_DIR], "solr.metrics.properties") props = load_properties_from_file(solr_metrics_props) collector_hosts = props.get("collector.hosts") if METRICS_COLLECTOR_VIP_HOST_KEY in configurations and METRICS_COLLECTOR_VIP_PORT_KEY in configurations: collector_host = configurations[METRICS_COLLECTOR_VIP_HOST_KEY] collector_port = int(configurations[METRICS_COLLECTOR_VIP_PORT_KEY]) else: collector_webapp_address = configurations[METRICS_COLLECTOR_WEBAPP_ADDRESS_KEY].split(":") if valid_collector_webapp_address(collector_webapp_address): collector_host = select_metric_collector_hosts_from_hostnames(collector_hosts) collector_port = int(collector_webapp_address[1]) else: return None, None return collector_host, collector_port
# Metrics solr_metrics_sink_dir = format('{solr_package_dir}/metrics') solr_metrics_sink_bin = format('{solr_metrics_sink_dir}/bin') # Metrics collector ams_collector_hosts = ",".join( default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 if has_metric_collector: if 'cluster-env' in config['configurations'] and \ 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env'][ 'metrics_collector_vip_host'] else: metric_collector_host = select_metric_collector_hosts_from_hostnames( ams_collector_hosts) if 'cluster-env' in config['configurations'] and \ 'metrics_collector_vip_port' in config['configurations']['cluster-env']: metric_collector_port = config['configurations']['cluster-env'][ 'metrics_collector_vip_port'] else: metric_collector_web_address = default( "/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: metric_collector_port = '6188' if default("/configurations/ams-site/timeline.metrics.service.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": metric_collector_protocol = 'https'
solr_metrics_kerberos_principal = solr_metrics_kerberos_principal.replace('_HOST', hostname) # Metrics solr_metrics_sink_dir = format('{solr_package_dir}/metrics') solr_metrics_sink_bin = format('{solr_metrics_sink_dir}/bin') # Metrics collector ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 if has_metric_collector: if 'cluster-env' in config['configurations'] and \ 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env'][ 'metrics_collector_vip_host'] else: metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) if 'cluster-env' in config['configurations'] and \ 'metrics_collector_vip_port' in config['configurations']['cluster-env']: metric_collector_port = config['configurations']['cluster-env'][ 'metrics_collector_vip_port'] else: metric_collector_web_address = default( "/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: metric_collector_port = '6188' if default("/configurations/ams-site/timeline.metrics.service.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": metric_collector_protocol = 'https' else: