Skip to content

Commit

Permalink
[Cloud Security] telemetry for agentless
Browse files Browse the repository at this point in the history
  • Loading branch information
CohenIdo authored Mar 7, 2024
1 parent ab796fd commit aaf3ad7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const cspmUsageSchema: MakeSchemaFrom<CspmUsage> = {
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' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/common/constants/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7700,6 +7700,9 @@
"agent_count": {
"type": "long"
},
"is_agentless": {
"type": "boolean"
},
"account_type": {
"type": "keyword"
},
Expand Down

0 comments on commit aaf3ad7

Please sign in to comment.