diff --git a/awx/api/views/root.py b/awx/api/views/root.py index 3ee22c6673..dba2dcf40b 100644 --- a/awx/api/views/root.py +++ b/awx/api/views/root.py @@ -159,11 +159,12 @@ class ApiV1PingView(APIView): 'ha': is_ha_environment(), 'version': get_awx_version(), 'active_node': settings.CLUSTER_HOST_ID, + 'install_uuid': settings.INSTALL_UUID, } response['instances'] = [] for instance in Instance.objects.all(): - response['instances'].append(dict(node=instance.hostname, heartbeat=instance.modified, + response['instances'].append(dict(node=instance.hostname, uuid=instance.uuid, heartbeat=instance.modified, capacity=instance.capacity, version=instance.version)) sorted(response['instances'], key=operator.itemgetter('node')) response['instance_groups'] = [] diff --git a/awx/main/analytics/metrics.py b/awx/main/analytics/metrics.py index a404a32496..d134abdc59 100644 --- a/awx/main/analytics/metrics.py +++ b/awx/main/analytics/metrics.py @@ -37,10 +37,10 @@ USER_SESSIONS = Gauge('awx_sessions_total', 'Number of sessions', ['type',]) CUSTOM_VENVS = Gauge('awx_custom_virtualenvs_total', 'Number of virtualenvs') RUNNING_JOBS = Gauge('awx_running_jobs_total', 'Number of running jobs on the Tower system') -INSTANCE_CAPACITY = Gauge('awx_instance_capacity', 'Capacity of each node in a Tower system', ['type',]) -INSTANCE_CPU = Gauge('awx_instance_cpu', 'CPU cores on each node in a Tower system', ['type',]) -INSTANCE_MEMORY = Gauge('awx_instance_memory', 'RAM (Kb) on each node in a Tower system', ['type',]) -INSTANCE_INFO = Info('awx_instance', 'Info about each node in a Tower system', ['type',]) +INSTANCE_CAPACITY = Gauge('awx_instance_capacity', 'Capacity of each node in a Tower system', ['instance_uuid',]) +INSTANCE_CPU = Gauge('awx_instance_cpu', 'CPU cores on each node in a Tower system', ['instance_uuid',]) +INSTANCE_MEMORY = Gauge('awx_instance_memory', 'RAM (Kb) on each node in a Tower system', ['instance_uuid',]) +INSTANCE_INFO = Info('awx_instance', 'Info about each node in a Tower system', ['instance_uuid',]) INSTANCE_LAUNCH_TYPE = Gauge('awx_instance_launch_type_total', 'Type of Job launched', ['node', 'launch_type',]) INSTANCE_STATUS = Gauge('awx_instance_status_total', 'Status of Job launched', ['node', 'status',]) @@ -48,7 +48,7 @@ INSTANCE_STATUS = Gauge('awx_instance_status_total', 'Status of Job launched', [ def metrics(): license_info = get_license(show_key=False) SYSTEM_INFO.info({ - 'system_uuid': settings.SYSTEM_UUID, + 'install_uuid': settings.INSTALL_UUID, 'insights_analytics': str(settings.INSIGHTS_DATA_ENABLED), 'tower_url_base': settings.TOWER_URL_BASE, 'tower_version': get_awx_version(), @@ -87,10 +87,10 @@ def metrics(): instance_data = instance_info(None) for uuid in instance_data: - INSTANCE_CAPACITY.labels(type=uuid).set(instance_data[uuid]['capacity']) - INSTANCE_CPU.labels(type=uuid).set(instance_data[uuid]['cpu']) - INSTANCE_MEMORY.labels(type=uuid).set(instance_data[uuid]['memory']) - INSTANCE_INFO.labels(type=uuid).info({ + INSTANCE_CAPACITY.labels(instance_uuid=uuid).set(instance_data[uuid]['capacity']) + INSTANCE_CPU.labels(instance_uuid=uuid).set(instance_data[uuid]['cpu']) + INSTANCE_MEMORY.labels(instance_uuid=uuid).set(instance_data[uuid]['memory']) + INSTANCE_INFO.labels(instance_uuid=uuid).info({ 'enabled': str(instance_data[uuid]['enabled']), 'last_isolated_check': getattr(instance_data[uuid], 'last_isolated_check', 'None'), 'managed_by_policy': str(instance_data[uuid]['managed_by_policy']), @@ -100,7 +100,6 @@ def metrics(): instance_data = job_instance_counts(None) for node in instance_data: # skipping internal execution node (for system jobs) - # TODO: determine if we should exclude execution_node from instance count if node == '': continue types = instance_data[node].get('launch_type', {}) diff --git a/awx/main/tests/functional/analytics/test_metrics.py b/awx/main/tests/functional/analytics/test_metrics.py index e9d9f11e51..8d3bb957e7 100644 --- a/awx/main/tests/functional/analytics/test_metrics.py +++ b/awx/main/tests/functional/analytics/test_metrics.py @@ -60,7 +60,6 @@ def test_metrics_counts(organization_factory, job_template_factory, workflow_job @pytest.mark.django_db def test_metrics_permissions(get, admin, org_admin, alice, bob, organization): - assert get(reverse('api:metrics_view'), user=admin).status_code == 200 assert get(reverse('api:metrics_view'), user=org_admin).status_code == 403 assert get(reverse('api:metrics_view'), user=alice).status_code == 403 @@ -75,7 +74,6 @@ def test_metrics_permissions(get, admin, org_admin, alice, bob, organization): @pytest.mark.django_db def test_metrics_http_methods(get, post, patch, put, options, admin): - assert get(reverse('api:metrics_view'), user=admin).status_code == 200 assert put(reverse('api:metrics_view'), user=admin).status_code == 405 assert patch(reverse('api:metrics_view'), user=admin).status_code == 405 diff --git a/awx/settings/development.py b/awx/settings/development.py index 7c02d3f929..a85a211e16 100644 --- a/awx/settings/development.py +++ b/awx/settings/development.py @@ -116,6 +116,7 @@ INSTALLED_APPS += ('rest_framework_swagger',) # Configure a default UUID for development only. SYSTEM_UUID = '00000000-0000-0000-0000-000000000000' +INSTALL_UUID = '00000000-0000-0000-0000-000000000000' # Store a snapshot of default settings at this point before loading any # customizable config files. diff --git a/tools/prometheus/data/lock b/tools/prometheus/data/lock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/prometheus/data/wal/00000000 b/tools/prometheus/data/wal/00000000 new file mode 100644 index 0000000000..4acb0cbcf1 Binary files /dev/null and b/tools/prometheus/data/wal/00000000 differ