feat(telemetry): add canonical VPS host monitoring
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
begin;
|
||||
|
||||
create table if not exists device_infrastructure_host_telemetry_samples (
|
||||
id uuid primary key,
|
||||
owner_scope_id uuid not null,
|
||||
project_id uuid not null,
|
||||
host_id uuid not null,
|
||||
service_instance_id uuid not null,
|
||||
edge_id uuid not null,
|
||||
observed_at timestamptz not null,
|
||||
received_at timestamptz not null default now(),
|
||||
expires_at timestamptz not null,
|
||||
schema_version text not null
|
||||
check (schema_version = 'nodedc.infrastructure.host-telemetry.v1'),
|
||||
profile_ref text not null
|
||||
check (profile_ref = 'linux-host-telegraf-v1'),
|
||||
agent_name text not null
|
||||
check (agent_name = 'telegraf'),
|
||||
agent_version text not null
|
||||
check (length(btrim(agent_version)) between 1 and 64),
|
||||
collector_ref text not null
|
||||
check (length(btrim(collector_ref)) between 3 and 160),
|
||||
provenance_ref text not null
|
||||
check (length(btrim(provenance_ref)) between 3 and 256),
|
||||
snapshot jsonb not null,
|
||||
ontology_entity_id text not null default 'observation.observation'
|
||||
check (ontology_entity_id = 'observation.observation'),
|
||||
ontology_catalog_hash text not null default '229c61c02a790906'
|
||||
check (ontology_catalog_hash = '229c61c02a790906'),
|
||||
created_at timestamptz not null default now(),
|
||||
unique (edge_id, observed_at),
|
||||
foreign key (host_id, project_id, owner_scope_id)
|
||||
references device_infrastructure_hosts(id, project_id, owner_scope_id),
|
||||
foreign key (service_instance_id, project_id, owner_scope_id)
|
||||
references device_infrastructure_service_instances(id, project_id, owner_scope_id),
|
||||
foreign key (edge_id) references device_edges(id),
|
||||
check (expires_at > observed_at),
|
||||
check (received_at >= observed_at - interval '5 minutes'),
|
||||
check (jsonb_typeof(snapshot) = 'object')
|
||||
);
|
||||
|
||||
create index if not exists device_host_telemetry_project_host_time_idx
|
||||
on device_infrastructure_host_telemetry_samples (
|
||||
project_id,
|
||||
host_id,
|
||||
observed_at desc
|
||||
);
|
||||
|
||||
create index if not exists device_host_telemetry_retention_idx
|
||||
on device_infrastructure_host_telemetry_samples (observed_at);
|
||||
|
||||
commit;
|
||||
Reference in New Issue
Block a user