[OsQuery] fix usage collector when .fleet indices are empty (#102977)
This commit is contained in:
parent
c6e697f38c
commit
a6bef93225
|
@ -56,6 +56,7 @@ export async function getPolicyLevelUsage(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index: '.fleet-agents',
|
index: '.fleet-agents',
|
||||||
|
ignore_unavailable: true,
|
||||||
});
|
});
|
||||||
const policied = agentResponse.body.aggregations?.policied as AggregationsSingleBucketAggregate;
|
const policied = agentResponse.body.aggregations?.policied as AggregationsSingleBucketAggregate;
|
||||||
if (policied && typeof policied.doc_count === 'number') {
|
if (policied && typeof policied.doc_count === 'number') {
|
||||||
|
@ -118,6 +119,7 @@ export async function getLiveQueryUsage(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index: '.fleet-actions',
|
index: '.fleet-actions',
|
||||||
|
ignore_unavailable: true,
|
||||||
});
|
});
|
||||||
const result: LiveQueryUsage = {
|
const result: LiveQueryUsage = {
|
||||||
session: await getRouteMetric(soClient, 'live_query'),
|
session: await getRouteMetric(soClient, 'live_query'),
|
||||||
|
@ -226,6 +228,7 @@ export async function getBeatUsage(esClient: ElasticsearchClient) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index: METRICS_INDICES,
|
index: METRICS_INDICES,
|
||||||
|
ignore_unavailable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return extractBeatUsageMetrics(metricResponse);
|
return extractBeatUsageMetrics(metricResponse);
|
||||||
|
|
Loading…
Reference in a new issue