Skip to content

Commit

Permalink
[Fleet] Display outputs in agent list table and agent details (#195801)
Browse files Browse the repository at this point in the history
Closes #192339

## Summary

Display two additional columns with Outputs hosts in agent list table
and agent details section
- The two columns show monitoring output and the integrations output and
link to the output flyout in settings
- Display a badge that show the outputs set per integration introduced
by #189125
- Same info displayed in agent details as well

To achieve this, I added two new endpoints.

1. Endpoint that fetches all the outputs associated with a single agent
policy (outputs defined on agent policy or default defined in global
settings and if any, outputs per integration)
```
GET kbn:/api/fleet/agent_policies/<AGENT_POLICY_ID>/outputs
```

2. Endpoint that fetches the outputs as above, for a defined set of
agent policy ids
```
POST kbn:/api/fleet/agent_policies/outputs
{
  "ids": ["policy_id1", "policy_id2", ...]
}
```
The reason to pass an array of ids is to ensure that we fetch the info
only for the policies displayed in the table at any given moment.


### Screenshots
**Agent list**
![Screenshot 2024-10-16 at 17 51
57](https:/user-attachments/assets/3ee08df1-9562-497f-9621-4a913b3dad74)
![Screenshot 2024-10-16 at 17 52
05](https:/user-attachments/assets/72b9da7d-872a-45f8-b02d-29184ffb2179)

**Agent details**
![Screenshot 2024-10-16 at 17 52
20](https:/user-attachments/assets/b99aaf9e-14f1-44b8-9776-3e0136775af8)


### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https:/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent 3130492 commit 3be33bd
Show file tree
Hide file tree
Showing 28 changed files with 2,547 additions and 42 deletions.
343 changes: 343 additions & 0 deletions oas_docs/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -9776,6 +9776,191 @@
]
}
},
"/api/fleet/agent_policies/outputs": {
"post": {
"description": "Get list of outputs associated with agent policies",
"operationId": "%2Fapi%2Ffleet%2Fagent_policies%2Foutputs#0",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
"name": "kbn-xsrf",
"required": true,
"schema": {
"example": "true",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"schema": {
"additionalProperties": false,
"properties": {
"ids": {
"description": "list of package policy ids",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"ids"
],
"type": "object"
}
}
}
},
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"schema": {
"additionalProperties": false,
"properties": {
"items": {
"items": {
"additionalProperties": false,
"properties": {
"agentPolicyId": {
"type": "string"
},
"data": {
"additionalProperties": false,
"properties": {
"integrations": {
"items": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"integrationPolicyName": {
"type": "string"
},
"name": {
"type": "string"
},
"pkgName": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"output": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"type": "object"
}
},
"required": [
"output"
],
"type": "object"
},
"monitoring": {
"additionalProperties": false,
"properties": {
"output": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"type": "object"
}
},
"required": [
"output"
],
"type": "object"
}
},
"required": [
"monitoring",
"data"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"items"
],
"type": "object"
}
}
}
},
"400": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"schema": {
"additionalProperties": false,
"description": "Generic Error",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
},
"statusCode": {
"type": "number"
}
},
"required": [
"message"
],
"type": "object"
}
}
}
}
},
"summary": "",
"tags": [
"Elastic Agent policies"
]
}
},
"/api/fleet/agent_policies/{agentPolicyId}": {
"get": {
"description": "Get an agent policy by ID",
Expand Down Expand Up @@ -12938,6 +13123,164 @@
]
}
},
"/api/fleet/agent_policies/{agentPolicyId}/outputs": {
"get": {
"description": "Get list of outputs associated with agent policy by policy id",
"operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Foutputs#0",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"in": "path",
"name": "agentPolicyId",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"schema": {
"additionalProperties": false,
"properties": {
"item": {
"additionalProperties": false,
"properties": {
"agentPolicyId": {
"type": "string"
},
"data": {
"additionalProperties": false,
"properties": {
"integrations": {
"items": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"integrationPolicyName": {
"type": "string"
},
"name": {
"type": "string"
},
"pkgName": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"output": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"type": "object"
}
},
"required": [
"output"
],
"type": "object"
},
"monitoring": {
"additionalProperties": false,
"properties": {
"output": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
],
"type": "object"
}
},
"required": [
"output"
],
"type": "object"
}
},
"required": [
"monitoring",
"data"
],
"type": "object"
}
},
"required": [
"item"
],
"type": "object"
}
}
}
},
"400": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"schema": {
"additionalProperties": false,
"description": "Generic Error",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
},
"statusCode": {
"type": "number"
}
},
"required": [
"message"
],
"type": "object"
}
}
}
}
},
"summary": "",
"tags": [
"Elastic Agent policies"
]
}
},
"/api/fleet/agent_status": {
"get": {
"description": "Get agent status summary",
Expand Down
Loading

0 comments on commit 3be33bd

Please sign in to comment.