Create an agent policy
Query parameters
-
sys_monitoring boolean
Body
-
advanced_settings object
Additional properties are NOT allowed.
-
agent_features array[object]
-
data_output_id string | null
-
description string
-
download_source_id string | null
-
fleet_server_host_id string | null
-
force boolean
-
has_fleet_server boolean
-
id string
-
inactivity_timeout number
Minimum value is
0
. Default value is1209600
. -
is_default boolean
-
is_default_fleet_server boolean
-
is_managed boolean
-
is_protected boolean
-
keep_monitoring_alive boolean | null
When set to true, monitoring will be enabled but logs/metrics collection will be disabled
Default value is
false
. -
monitoring_diagnostics object
Additional properties are NOT allowed.
-
monitoring_enabled array[string]
Values are
logs
,metrics
, ortraces
. -
monitoring_http object
Additional properties are NOT allowed.
-
monitoring_output_id string | null
-
monitoring_pprof_enabled boolean
-
Minimum length is
1
. -
Minimum length is
1
. -
overrides object | null
Override settings that are defined in the agent policy. Input settings cannot be overridden. The override option should be used only in unusual circumstances and not as a routine procedure.
Additional properties are allowed.
-
space_ids array[string]
-
supports_agentless boolean | null
Indicates whether the agent policy supports agentless integrations.
Default value is
false
. -
unenroll_timeout number
Minimum value is
0
.
POST
/api/fleet/agent_policies
curl \
-X POST https://localhost:5601/api/fleet/agent_policies \
-H "Content-Type: application/json; Elastic-Api-Version=2023-10-31" \
-H "kbn-xsrf: true"
Request examples
# Headers
kbn-xsrf: true
# Payload
{
"advanced_settings": {},
"agent_features": [
{
"enabled": true,
"name": "string"
}
],
"data_output_id": "string",
"description": "string",
"download_source_id": "string",
"fleet_server_host_id": "string",
"force": true,
"global_data_tags": [
{
"name": "string",
"value": "string"
}
],
"has_fleet_server": true,
"id": "string",
"inactivity_timeout": 1209600,
"is_default": true,
"is_default_fleet_server": true,
"is_managed": true,
"is_protected": true,
"keep_monitoring_alive": false,
"monitoring_diagnostics": {
"limit": {
"burst": 42.0,
"interval": "string"
},
"uploader": {
"init_dur": "string",
"max_dur": "string",
"max_retries": 42.0
}
},
"monitoring_enabled": [
"logs"
],
"monitoring_http": {
"buffer": {
"enabled": false
},
"enabled": true,
"host": "string",
"port": 42.0
},
"monitoring_output_id": "string",
"monitoring_pprof_enabled": true,
"name": "string",
"namespace": "string",
"overrides": {},
"space_ids": [
"string"
],
"supports_agentless": false,
"unenroll_timeout": 42.0
}
Response examples (200)
{
"item": {
"advanced_settings": {},
"agent_features": [
{
"enabled": true,
"name": "string"
}
],
"agents": 42.0,
"data_output_id": "string",
"description": "string",
"download_source_id": "string",
"fleet_server_host_id": "string",
"global_data_tags": [
{
"name": "string",
"value": "string"
}
],
"has_fleet_server": true,
"id": "string",
"inactivity_timeout": 1209600,
"is_default": true,
"is_default_fleet_server": true,
"is_managed": true,
"is_preconfigured": true,
"is_protected": true,
"keep_monitoring_alive": false,
"monitoring_diagnostics": {
"limit": {
"burst": 42.0,
"interval": "string"
},
"uploader": {
"init_dur": "string",
"max_dur": "string",
"max_retries": 42.0
}
},
"monitoring_enabled": [
"logs"
],
"monitoring_http": {
"buffer": {
"enabled": false
},
"enabled": true,
"host": "string",
"port": 42.0
},
"monitoring_output_id": "string",
"monitoring_pprof_enabled": true,
"name": "string",
"namespace": "string",
"overrides": {},
"package_policies": [
"string"
],
"revision": 42.0,
"schema_version": "string",
"space_ids": [
"string"
],
"status": "active",
"supports_agentless": false,
"unenroll_timeout": 42.0,
"unprivileged_agents": 42.0,
"updated_at": "string",
"updated_by": "string",
"version": "string"
}
}
Response examples (400)
{
"error": "string",
"message": "string",
"statusCode": 42.0
}