def check(auth_ref, args): keystone = get_keystone_client(auth_ref) tenant_id = keystone.tenant_id HEAT_ENDPOINT = ('http://{ip}:8004/v1/{tenant}'.format(ip=args.ip, tenant=tenant_id)) try: if args.ip: heat = get_heat_client(endpoint=HEAT_ENDPOINT) else: heat = get_heat_client() is_up = True except exc.HTTPException as e: is_up = False # Any other exception presumably isn't an API error except Exception as e: status_err(str(e)) else: # time something arbitrary start = time.time() heat.build_info.build_info() end = time.time() milliseconds = (end - start) * 1000 metric('heat_api', 'heat_api_local_status', str(int(is_up))) if is_up: # only want to send other metrics if api is up metric('heat_api', 'heat_api_local_response_time', '%.3f' % milliseconds)
def check(auth_ref, args): keystone = get_keystone_client(auth_ref) tenant_id = keystone.tenant_id HEAT_ENDPOINT = ('http://{ip}:8004/v1/{tenant}'.format (ip=args.ip, tenant=tenant_id)) try: if args.ip: heat = get_heat_client(endpoint=HEAT_ENDPOINT) else: heat = get_heat_client() is_up = True except exc.HTTPException as e: is_up = False # Any other exception presumably isn't an API error except Exception as e: status_err(str(e)) else: # time something arbitrary start = time.time() heat.build_info.build_info() end = time.time() milliseconds = (end - start) * 1000 status_ok() metric_bool('heat_api_local_status', is_up) if is_up: # only want to send other metrics if api is up metric('heat_api_local_response_time', 'double', '%.3f' % milliseconds, 'ms')
def check(auth_ref, args): keystone = get_keystone_client(auth_ref) tenant_id = keystone.tenant_id heat_endpoint = ('{protocol}://{ip}:{port}/v1/{tenant}'.format( ip=args.ip, tenant=tenant_id, protocol=args.protocol, port=args.port)) try: if args.ip: heat = get_heat_client(endpoint=heat_endpoint) else: heat = get_heat_client() is_up = True except exc.HTTPException as e: is_up = False metric_bool('client_success', False, m_name='maas_heat') # Any other exception presumably isn't an API error except Exception as e: metric_bool('client_success', False, m_name='maas_heat') status_err(str(e), m_name='maas_heat') else: metric_bool('client_success', True, m_name='maas_heat') # time something arbitrary start = time.time() heat.build_info.build_info() end = time.time() milliseconds = (end - start) * 1000 status_ok(m_name='maas_heat') metric_bool('heat_api_local_status', is_up, m_name='maas_heat') if is_up: # only want to send other metrics if api is up metric('heat_api_local_response_time', 'double', '%.3f' % milliseconds, 'ms')
def check(args, tenant_id): HEAT_ENDPOINT = ('http://{ip}:8004/v1/{tenant}'.format (ip=args.ip, tenant=tenant_id)) try: heat = get_heat_client(endpoint=HEAT_ENDPOINT) is_up = True except exc.HTTPException as e: is_up = False # Any other exception presumably isn't an API error except Exception as e: status_err(str(e)) else: # time something arbitrary start = time() heat.build_info.build_info() end = time() milliseconds = (end - start) * 1000 # Add other metrics stack_count = len(list(heat.stacks.list())) status_ok() metric_bool('heat_api_local_status', is_up) if is_up: # only want to send other metrics if api is up metric('heat_api_local_response_time', 'double', '%.3f' % milliseconds, 'ms') metric('heat_stack_count', 'uint32', stack_count, 'stacks')
def check(): try: keystone = get_keystone_client(CONFIGS['auth_ref']) tenant_id = keystone.tenant_id HEAT_ENDPOINT = ('http://{ip}:8004/v1/{tenant}'.format( ip=CONFIGS['ip'], tenant=tenant_id)) try: if CONFIGS['ip']: heat = get_heat_client(endpoint=HEAT_ENDPOINT) else: heat = get_heat_client() is_up = True except exc.HTTPException as e: is_up = False # Any other exception presumably isn't an API error except Exception as e: status_err(str(e)) else: # time something arbitrary start = time.time() heat.build_info.build_info() end = time.time() milliseconds = (end - start) * 1000 status_ok() metric_bool(PLUGIN, 'heat_api_local_status', is_up, graphite_host=CONFIGS['graphite_host'], graphite_port=CONFIGS['graphite_port']) if is_up: # only want to send other metrics if api is up metric(PLUGIN, 'heat_api_local_response_time', '%.3f' % milliseconds, graphite_host=CONFIGS['graphite_host'], graphite_port=CONFIGS['graphite_port']) except: metric_bool(PLUGIN, 'heat_api_local_status', is_up, graphite_host=CONFIGS['graphite_host'], graphite_port=CONFIGS['graphite_port']) raise
def check(auth_ref, args): keystone = get_keystone_client(auth_ref) tenant_id = keystone.tenant_id heat_endpoint = ('{protocol}://{ip}:{port}/v1/{tenant}'.format( ip=args.ip, tenant=tenant_id, protocol=args.protocol, port=args.port )) try: if args.ip: heat = get_heat_client(endpoint=heat_endpoint) else: heat = get_heat_client() is_up = True except exc.HTTPException as e: is_up = False metric_bool('client_success', False, m_name='maas_heat') # Any other exception presumably isn't an API error except Exception as e: metric_bool('client_success', False, m_name='maas_heat') status_err(str(e), m_name='maas_heat') else: metric_bool('client_success', True, m_name='maas_heat') # time something arbitrary start = time.time() heat.build_info.build_info() end = time.time() milliseconds = (end - start) * 1000 status_ok(m_name='maas_heat') metric_bool('heat_api_local_status', is_up, m_name='maas_heat') if is_up: # only want to send other metrics if api is up metric('heat_api_local_response_time', 'double', '%.3f' % milliseconds, 'ms')