diff --git a/CHANGELOG.md b/CHANGELOG.md index be0790fa67..cae1d85aea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Removed deprecated request and code in agent's view [#5451](https://github.com/wazuh/wazuh-kibana-app/pull/5451) - Removed unnecessary dashboard queries caused by the deploy agent view. [#5453](https://github.com/wazuh/wazuh-kibana-app/pull/5453) - Removed repeated and unnecessary requests in security section. [#5500](https://github.com/wazuh/wazuh-kibana-app/pull/5500) +- Removed pretty parameter from cron job requests. [#5532](https://github.com/wazuh/wazuh-kibana-app/pull/5532) - Removed unnecessary requests in `Management/Status` section. [#5528](https://github.com/wazuh/wazuh-kibana-app/pull/5528) ## Wazuh v4.4.3 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 01 diff --git a/docker/imposter/cluster/cluster-node-info.js b/docker/imposter/cluster/cluster-node-info.js new file mode 100644 index 0000000000..7be80292fa --- /dev/null +++ b/docker/imposter/cluster/cluster-node-info.js @@ -0,0 +1,39 @@ + +var selectedNode = context.request.queryParams.select + +switch (selectedNode) { + case 'name': + respond() + .withStatusCode(200) + .withFile('cluster/node/select-name.json'); + break; + default: + respond() + .withStatusCode(200) + .withFile('cluster/node/response-with-everything.json'); + break; +} + +// Commented code is used to test the restart only +// +// var storeWazuh = stores.open('storeWazuh'); +// var attemptRestart = storeWazuh.load('attempt'); +// var callRestart = storeWazuh.load('callRestart'); +// if (callRestart) { +// if (attemptRestart < 10) { +// storeWazuh.save('attempt', attemptRestart + 1); +// respond() +// .withStatusCode(200) +// .withFile('cluster/cluster-node-info-no-restart.json') +// } else { +// storeWazuh.save('attempt', 0); +// storeWazuh.save('callRestart', false); +// respond() +// .withStatusCode(200) +// .withFile('cluster/cluster-node-info.json') +// } +// } else { +// respond() +// .withStatusCode(200) +// .withFile('cluster/cluster-node-info.json') +// } diff --git a/docker/imposter/cluster/cluster_node_info.js b/docker/imposter/cluster/cluster_node_info.js deleted file mode 100644 index 0fc487f1a4..0000000000 --- a/docker/imposter/cluster/cluster_node_info.js +++ /dev/null @@ -1,24 +0,0 @@ - -var storeWazuh = stores.open('storeWazuh'); -var attemptRestart = storeWazuh.load('attempt'); -var callRestart = storeWazuh.load('callRestart'); - - -if (callRestart) { - if (attemptRestart < 10) { - storeWazuh.save('attempt', attemptRestart + 1); - respond() - .withStatusCode(200) - .withFile('cluster/cluster_node_info_no_restart.json') - } else { - storeWazuh.save('attempt', 0); - storeWazuh.save('callRestart', false); - respond() - .withStatusCode(200) - .withFile('cluster/cluster_node_info.json') - } -} else { - respond() - .withStatusCode(200) - .withFile('cluster/cluster_node_info.json') -} diff --git a/docker/imposter/cluster/cluster_node_info.json b/docker/imposter/cluster/node/response-with-everything.json similarity index 100% rename from docker/imposter/cluster/cluster_node_info.json rename to docker/imposter/cluster/node/response-with-everything.json diff --git a/docker/imposter/cluster/node/select-name.json b/docker/imposter/cluster/node/select-name.json new file mode 100644 index 0000000000..d4d7c234d4 --- /dev/null +++ b/docker/imposter/cluster/node/select-name.json @@ -0,0 +1,50 @@ +{ + "data": { + "affected_items": [ + { + "name": "master-node" + }, + { + "name": "worker1" + }, + { + "name": "worker2" + }, + { + "name": "worker3" + }, + { + "name": "worker4" + }, + { + "name": "worker5" + }, + { + "name": "worker6" + }, + { + "name": "worker7" + }, + { + "name": "worker8" + }, + { + "name": "worker9" + }, + { + "name": "worker10" + }, + { + "name": "worker11" + }, + { + "name": "worker12" + } + ], + "total_affected_items": 3, + "total_failed_items": 0, + "failed_items": [] + }, + "message": "All selected nodes information was returned", + "error": 0 +} diff --git a/docker/imposter/wazuh-config.yml b/docker/imposter/wazuh-config.yml index 830fe02e4c..94298f0363 100755 --- a/docker/imposter/wazuh-config.yml +++ b/docker/imposter/wazuh-config.yml @@ -170,7 +170,7 @@ resources: path: /cluster/nodes response: statusCode: 200 - scriptFile: cluster/cluster_node_info.js + scriptFile: cluster/cluster-node-info.js # Get nodes healthcheck - method: GET diff --git a/server/start/cron-scheduler/predefined-jobs.ts b/server/start/cron-scheduler/predefined-jobs.ts index 9a0638257c..5d5ef84d9d 100644 --- a/server/start/cron-scheduler/predefined-jobs.ts +++ b/server/start/cron-scheduler/predefined-jobs.ts @@ -24,7 +24,7 @@ export const jobs: {[key:string]: IJob} = { 'manager-stats-remoted': { status: true, method: "GET", - request: '/manager/stats/remoted?pretty', + request: '/manager/stats/remoted', params: {}, interval: '0 */5 * * * *', index: { @@ -36,7 +36,7 @@ export const jobs: {[key:string]: IJob} = { 'manager-stats-analysisd': { status: true, method: "GET", - request: '/manager/stats/analysisd?pretty', + request: '/manager/stats/analysisd', params: {}, interval: '0 */5 * * * *', index: { @@ -49,7 +49,7 @@ export const jobs: {[key:string]: IJob} = { status: true, method: "GET", request: { - request: '/cluster/{nodeName}/stats/remoted?pretty', + request: '/cluster/{nodeName}/stats/remoted', params: { nodeName: { request: '/cluster/nodes?select=name' @@ -68,7 +68,7 @@ export const jobs: {[key:string]: IJob} = { status: true, method: "GET", request: { - request: '/cluster/{nodeName}/stats/analysisd?pretty', + request: '/cluster/{nodeName}/stats/analysisd', params: { nodeName: { request: '/cluster/nodes?select=name' @@ -83,4 +83,4 @@ export const jobs: {[key:string]: IJob} = { mapping: '{"analysisd": ${data.affected_items[0]}, "apiName": ${apiName}, "nodeName": ${nodeName}, "cluster": "true"}', } }, -} \ No newline at end of file +}