Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] [Monitoring] Retrieve data of all agents #3728

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Refactored as module tabs and buttons are rendered [#3494](https://github.com/wazuh/wazuh-kibana-app/pull/3494)
- Testing logs using the Ruletest Test don't display the rule information if not matching a rule. [#3446](https://github.com/wazuh/wazuh-kibana-app/pull/3446)
- Changed format permissions in FIM inventory [#3649](https://github.com/wazuh/wazuh-kibana-app/pull/3649)
- Changed of request for one that does not return data that is not necessary to optimize times. [#3686](https://github.com/wazuh/wazuh-kibana-app/pull/3686)
- Changed of request for one that does not return data that is not necessary to optimize times. [#3686](https://github.com/wazuh/wazuh-kibana-app/pull/3686) [#3728](https://github.com/wazuh/wazuh-kibana-app/pull/3728)

### Fixed

Expand Down
15 changes: 15 additions & 0 deletions server/start/monitoring/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,26 @@ async function fetchAllAgentsFromApiHost(context, apiHost){

let payload = {
offset: 0,
limit: 500,
q: 'id!=000'
};

while (agents.length < agentsCount && payload.offset < agentsCount) {
try{
/*
TODO: Improve the performance of request with:
- Reduce the number of requests to the Wazuh API
- Reduce (if possible) the quantity of data to index by document

Requirements:
- Research about the neccesary data to index.

How to do:
- Wazuh API request:
- select the required data to retrieve depending on is required to index (using the `select` query param)
- increase the limit of results to retrieve (currently, the requests use the recommended value: 500).
See the allowed values. This depends on the selected data because the response could fail if contains a lot of data
*/
const responseAgents = await context.wazuh.api.client.asInternalUser.request(
'GET',
`/agents`,
Expand Down