diff --git a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/installation_stats_collector.ts b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/installation_stats_collector.ts index 25211172d7c89..ed77a552451ad 100644 --- a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/installation_stats_collector.ts +++ b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/installation_stats_collector.ts @@ -13,6 +13,7 @@ import { SO_SEARCH_LIMIT, } from '@kbn/fleet-plugin/common'; import { agentPolicyService } from '@kbn/fleet-plugin/server/services'; +import { AGENTLESS_POLICY_ID } from '@kbn/fleet-plugin/common/constants'; import type { CloudbeatConfigKeyType, CloudSecurityInstallationStats, @@ -101,6 +102,9 @@ const getInstalledPackagePolicies = ( const agentCounts = agentPolicies?.find((agentPolicy) => agentPolicy?.id === packagePolicy.policy_id)?.agents ?? 0; + + const isAgentless = packagePolicy.policy_id === AGENTLESS_POLICY_ID; + const isSetupAutomatic = getEnabledIsSetupAutomatic(packagePolicy); return { @@ -111,6 +115,7 @@ const getInstalledPackagePolicies = ( created_at: packagePolicy.created_at, agent_policy_id: packagePolicy.policy_id, agent_count: agentCounts, + is_agentless: isAgentless, account_type: getAccountTypeField(packagePolicy), is_setup_automatic: isSetupAutomatic, setup_access_option: isSetupAutomatic ? null : getSetupAccessOption(packagePolicy), diff --git a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/schema.ts b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/schema.ts index 22be67ca6a7b1..1cb230185b7bc 100644 --- a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/schema.ts +++ b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/schema.ts @@ -153,6 +153,7 @@ export const cspmUsageSchema: MakeSchemaFrom = { deployment_mode: { type: 'keyword' }, created_at: { type: 'date' }, agent_count: { type: 'long' }, + is_agentless: { type: 'boolean' }, account_type: { type: 'keyword' }, is_setup_automatic: { type: 'boolean' }, setup_access_option: { type: 'keyword' }, diff --git a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/types.ts b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/types.ts index 35308647df386..370c9676099d6 100644 --- a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/types.ts +++ b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/types.ts @@ -143,6 +143,7 @@ export interface CloudSecurityInstallationStats { created_at: string; agent_count: number; is_setup_automatic: boolean; + is_agentless: boolean; account_type?: 'single-account' | 'organization-account'; setup_access_option: SetupAccessOption; } diff --git a/x-pack/plugins/fleet/common/constants/agent_policy.ts b/x-pack/plugins/fleet/common/constants/agent_policy.ts index 2c54b2961da01..a52a0cdc7bfcb 100644 --- a/x-pack/plugins/fleet/common/constants/agent_policy.ts +++ b/x-pack/plugins/fleet/common/constants/agent_policy.ts @@ -35,3 +35,5 @@ export const AGENT_POLICY_DEFAULT_MONITORING_DATASETS = [ export const LICENSE_FOR_SCHEDULE_UPGRADE = 'platinum'; export const DEFAULT_MAX_AGENT_POLICIES_WITH_INACTIVITY_TIMEOUT = 750; + +export const AGENTLESS_POLICY_ID = 'agentless'; // the policy id defined here: https://github.com/elastic/project-controller/blob/main/internal/project/security/security_kibana_config.go#L86 diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts index 89f45593ebfff..6e6c0102a35ff 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.ts @@ -12,8 +12,7 @@ import type { AgentPolicy, NewAgentPolicy } from '../../../../../types'; import { SetupTechnology } from '../../../../../types'; import { sendGetOneAgentPolicy, useStartServices } from '../../../../../hooks'; import { SelectedPolicyTab } from '../../components'; - -export const AGENTLESS_POLICY_ID = 'agentless'; +import { AGENTLESS_POLICY_ID } from '../../../../../../../../common/constants'; export const useAgentlessPolicy = () => { const { agentless: agentlessExperimentalFeatureEnabled } = ExperimentalFeaturesService.get(); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx index a479810ba5f5b..cab5a5e8bf273 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.test.tsx @@ -102,7 +102,7 @@ jest.mock('react-router-dom', () => ({ })); import { CreatePackagePolicySinglePage } from '.'; -import { AGENTLESS_POLICY_ID } from './hooks/setup_technology'; +import { AGENTLESS_POLICY_ID } from '../../../../../../../common/constants'; // mock console.debug to prevent noisy logs from console.debugs in ./index.tsx let consoleDebugMock: any; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 412939f649eca..751e0cf233b97 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -46,9 +46,11 @@ import { StepConfigurePackagePolicy, StepDefinePackagePolicy, } from '../create_package_policy_page/components'; -import { AGENTLESS_POLICY_ID } from '../create_package_policy_page/single_page_layout/hooks/setup_technology'; -import { HIDDEN_API_REFERENCE_PACKAGES } from '../../../../../../common/constants'; +import { + AGENTLESS_POLICY_ID, + HIDDEN_API_REFERENCE_PACKAGES, +} from '../../../../../../common/constants'; import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; import { ExperimentalFeaturesService, pkgKeyFromPackageInfo } from '../../../services'; import { generateUpdatePackagePolicyDevToolsRequest } from '../services'; diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 9ff55d4bd5ebe..e63c782f4e965 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -7700,6 +7700,9 @@ "agent_count": { "type": "long" }, + "is_agentless": { + "type": "boolean" + }, "account_type": { "type": "keyword" },