diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index 11ddf379df042..8f5dd3bf44bcf 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -1308,10 +1308,17 @@ "type": "integer" }, "total": { - "type": "integer" + "type": "integer", + "deprecated": true }, "updating": { "type": "integer" + }, + "all": { + "type": "integer" + }, + "active": { + "type": "integer" } }, "required": [ @@ -1322,7 +1329,9 @@ "online", "other", "total", - "updating" + "updating", + "all", + "active" ] } } diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index 5b4b6a61a9fff..932a7b9e5a013 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -824,8 +824,13 @@ paths: type: integer total: type: integer + deprecated: true updating: type: integer + all: + type: integer + active: + type: integer required: - error - events @@ -835,6 +840,8 @@ paths: - other - total - updating + - all + - active operationId: get-agent-status parameters: - schema: diff --git a/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml b/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml index 872aca9eb2758..71e078b07c08c 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml @@ -25,8 +25,13 @@ get: type: integer total: type: integer + deprecated: true updating: type: integer + all: + type: integer + active: + type: integer required: - error - events @@ -36,6 +41,8 @@ get: - other - total - updating + - all + - active operationId: get-agent-status parameters: - schema: diff --git a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts index 10866da70d93e..7a73829838d55 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts @@ -185,6 +185,7 @@ export interface GetAgentStatusRequest { export interface GetAgentStatusResponse { results: { events: number; + // deprecated total: number; online: number; error: number; @@ -193,6 +194,8 @@ export interface GetAgentStatusResponse { updating: number; inactive: number; unenrolled: number; + all: number; + active: number; }; } diff --git a/x-pack/plugins/fleet/server/services/agents/status.ts b/x-pack/plugins/fleet/server/services/agents/status.ts index 88761c53ee473..041298d57b4eb 100644 --- a/x-pack/plugins/fleet/server/services/agents/status.ts +++ b/x-pack/plugins/fleet/server/services/agents/status.ts @@ -126,16 +126,18 @@ export async function getAgentStatusForAgentPolicy( const { healthy: online, unhealthy: error, ...otherStatuses } = agentStatusesToSummary(statuses); const combinedStatuses = { online, error, ...otherStatuses }; + const allStatuses = Object.values(statuses).reduce((acc, val) => acc + val, 0); + const allActive = allStatuses - combinedStatuses.unenrolled - combinedStatuses.inactive; return { ...combinedStatuses, /* @deprecated no agents will have other status */ other: 0, /* @deprecated Agent events do not exists anymore */ events: 0, - total: - Object.values(statuses).reduce((acc, val) => acc + val, 0) - - combinedStatuses.unenrolled - - combinedStatuses.inactive, + /* @deprecated use active instead */ + total: allActive, + all: allStatuses, + active: allActive, }; } export async function getIncomingDataByAgentsId( diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/reducer/initial_policy_details_state.ts b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/reducer/initial_policy_details_state.ts index 20b8b46538f53..bdce8d49573f7 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/reducer/initial_policy_details_state.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/reducer/initial_policy_details_state.ts @@ -25,6 +25,8 @@ export const initialPolicyDetailsState: () => Immutable = () online: 0, total: 0, other: 0, + all: 0, + active: 0, }, artifacts: { location: { diff --git a/x-pack/test/fleet_api_integration/apis/agents/status.ts b/x-pack/test/fleet_api_integration/apis/agents/status.ts index 89a3a67bbf3f5..4908e1d2e8c6d 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/status.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/status.ts @@ -219,6 +219,8 @@ export default function ({ getService }: FtrProviderContext) { other: 0, total: 8, online: 2, + active: 8, + all: 11, error: 2, offline: 1, updating: 3, @@ -298,6 +300,8 @@ export default function ({ getService }: FtrProviderContext) { other: 0, total: 10, online: 3, + active: 10, + all: 11, error: 2, offline: 1, updating: 4,