Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [Fleet] Correctly check for degraded status in agent healthbar (#102821) #102842

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/common/services/agent_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function buildKueryForOnlineAgents() {
}

export function buildKueryForErrorAgents() {
return 'last_checkin_status:error or .last_checkin_status:degraded';
return 'last_checkin_status:error or last_checkin_status:degraded';
}

export function buildKueryForOfflineAgents() {
Expand Down
16 changes: 10 additions & 6 deletions x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ export default function (providerContext: FtrProviderContext) {
let data: any = {};

switch (status) {
case 'unhealthy':
case 'error':
data = { last_checkin_status: 'error' };
break;
case 'degraded':
data = { last_checkin_status: 'degraded' };
break;
case 'offline':
data = { last_checkin: '2017-06-07T18:59:04.498Z' };
break;
Expand Down Expand Up @@ -85,12 +88,13 @@ export default function (providerContext: FtrProviderContext) {
// Default Fleet Server
await generateAgent('healthy', defaultFleetServerPolicy.id);
await generateAgent('healthy', defaultFleetServerPolicy.id);
await generateAgent('unhealthy', defaultFleetServerPolicy.id);
await generateAgent('error', defaultFleetServerPolicy.id);

// Default policy
await generateAgent('healthy', defaultServerPolicy.id);
await generateAgent('offline', defaultServerPolicy.id);
await generateAgent('unhealthy', defaultServerPolicy.id);
await generateAgent('error', defaultServerPolicy.id);
await generateAgent('degraded', defaultServerPolicy.id);
});

it('should return the correct telemetry values for fleet', async () => {
Expand All @@ -105,12 +109,12 @@ export default function (providerContext: FtrProviderContext) {
.expect(200);

expect(apiResponse.stack_stats.kibana.plugins.fleet.agents).eql({
total_enrolled: 6,
total_enrolled: 7,
healthy: 3,
unhealthy: 2,
unhealthy: 3,
offline: 1,
updating: 0,
total_all_statuses: 6,
total_all_statuses: 7,
});

expect(apiResponse.stack_stats.kibana.plugins.fleet.fleet_server).eql({
Expand Down