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 /cluster/:node_id/stats/remoted and /cluster/:node_id/stats/analysisd API calls #479

Merged
merged 4 commits into from
Mar 17, 2020

Conversation

davidjiglesias
Copy link
Member

@davidjiglesias davidjiglesias commented Mar 17, 2020

Hello team,

This PR closes #470.

It fixes API calls GET /cluster/:node_id/stats/remoted and GET /cluster/:node_id/stats/analysisd so the call is appropriately distributed to the cluster nodes.

Mocha test results:

Cluster
    GET/cluster/nodes
(node:2755) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (265ms)
      ✓ Pagination (245ms)
      ✓ Retrieve all elements with limit=0 (252ms)
      ✓ Sort (249ms)
      ✓ Search (252ms)
      ✓ Select (251ms)
      ✓ Select 2 (253ms)
      ✓ Wrong select (255ms)
      ✓ Filters: type (263ms)
      ✓ Filters: query 1 (256ms)
      ✓ Filters: query 2 (256ms)
      ✓ Filters: invalid type (258ms)
    GET/cluster/:node_id/stats
      ✓ Cluster stats (249ms)
      ✓ Unexisting node stats (245ms)
      ✓ Analysisd stats (master) (249ms)
      ✓ Analysisd stats (worker-1) (251ms)
      ✓ Analysisd stats (257ms)
      ✓ Remoted stats (master) (250ms)
      ✓ Remoted stats (worker-1) (260ms)
      ✓ Remoted stats (worker-2) (251ms)
    GET/cluster/:node_id/logs
      ✓ Request (master) (266ms)
      ✓ Request (worker-1) (271ms)
      ✓ Request (worker-2) (269ms)
      ✓ Pagination (289ms)
      ✓ Sort (269ms)
      ✓ Search (263ms)
      ✓ Filters: type_log (261ms)
      ✓ Filters: category (253ms)
      ✓ Filters: query 1 (266ms)
      ✓ Filters: query 2 (273ms)
      ✓ Filters: query 3 (267ms)
      ✓ Filters: wrong query (78ms)
    GET/cluster/nodes/:node_name
      ✓ Request (258ms)
      ✓ Request wrong name (283ms)
    GET/cluster/status
      ✓ Request (255ms)
    GET/cluster/config
      ✓ Request (252ms)
    GET/cluster/healthcheck
      ✓ Request (288ms)
      ✓ Filter: node name (269ms)
    POST/cluster/:node_id/files
      ✓ Upload ossec.conf (master) (256ms)
      ✓ Upload ossec.conf (worker) (277ms)
      ✓ Upload new rules (268ms)
      ✓ Upload rules (overwrite=true) (261ms)
      ✓ Upload rules (overwrite=false) (253ms)
      ✓ Upload new decoder (247ms)
      ✓ Upload decoder (overwrite=true) (247ms)
      ✓ Upload decoder (without overwrite parameter) (271ms)
      ✓ Upload new list (266ms)
      ✓ Upload list (overwrite=true) (247ms)
      ✓ Upload list (overwrite=false) (259ms)
      ✓ Upload corrupted ossec.conf (master) (89ms)
      ✓ Upload corrupted ossec.conf (worker) (96ms)
      ✓ Upload malformed rules (83ms)
      ✓ Upload rules to unexisting node (261ms)
      ✓ Upload malformed decoder (80ms)
      ✓ Upload decoder to unexisting node (244ms)
      ✓ Upload malformed list (90ms)
      ✓ Upload list to unexisting node (286ms)
      ✓ Upload list with empty path (83ms)
      ✓ Upload a file with a wrong content type (87ms)
    GET/cluster/:node_id/files
      ✓ Request ossec.conf (master) (256ms)
      ✓ Request ossec.conf (worker) (263ms)
      ✓ Request rules (local) (251ms)
      ✓ Request rules (global) (250ms)
      ✓ Request decoders (local) (246ms)
      ✓ Request decoders (global) (242ms)
      ✓ Request lists (244ms)
      ✓ Request wrong path 1 (76ms)
      ✓ Request wrong path 2 (95ms)
      ✓ Request wrong path 3 (106ms)
      ✓ Request unexisting file (253ms)
      ✓ Request file from unexisting node (244ms)
      ✓ Request file with empty path (78ms)
      ✓ Request file with validation parameter (true) (265ms)
    GET/cluster/:node_id/configuration/validation (manager and worker OK)
      ✓ Request validation (master) (704ms)
      ✓ Request validation (worker) (693ms)
      ✓ Request validation (all nodes) (751ms)
    GET/cluster/:node_id/configuration/validation (manager KO, worker OK)
      ✓ Request validation (master) (245ms)
      ✓ Request validation (worker) (669ms)
      ✓ Request validation (all nodes) (716ms)
    GET/cluster/:node_id/configuration/validation (manager OK, worker KO)
      ✓ Request validation (master) (683ms)
      ✓ Request validation (worker) (257ms)
      ✓ Request validation (all nodes) (721ms)
    GET/cluster/:node_id/configuration/validation (manager and worker KO)
      ✓ Request validation (master) (252ms)
      ✓ Request validation (worker) (259ms)
      ✓ Request validation (all nodes) (262ms)
    DELETE/cluster/:node_id/files
      ✓ Delete rules (master) (244ms)
      ✓ Delete decoders (master) (242ms)
      ✓ Delete CDB list (master) (240ms)
      ✓ Delete file with empty path (77ms)
    GET/cluster/master/config/:component/:configuration
      ✓ Request-Agentless-Agentless (253ms)
      ✓ Request-Analysis-Global (253ms)
      ✓ Request-Analysis-Active-response (243ms)
      ✓ Request-Analysis-Alerts (251ms)
      ✓ Request-Analysis-Command (245ms)
      ✓ Request-Analysis-Internal (261ms)
      ✓ Request-Auth-Auth (267ms)
      ✓ Request-Com-Active-response (250ms)
      ✓ Request-Com-Internal (264ms)
      ✓ Request-Csyslog-Csyslog (249ms)
      ✓ Request-Integrator-Integration (243ms)
      ✓ Request-Logcollector-Localfile (247ms)
      ✓ Request-Logcollector-Socket (250ms)
      ✓ Request-Logcollector-Internal (252ms)
      ✓ Request-Mail-Global (246ms)
      ✓ Request-Mail-Alerts (245ms)
      ✓ Request-Mail-Internal (246ms)
      ✓ Request-Monitor-Internal (265ms)
      ✓ Request-Request-Remote (248ms)
      ✓ Request-Request-Internal (256ms)
      ✓ Request-Syscheck-Syscheck (246ms)
      ✓ Request-Syscheck-Rootcheck (249ms)
      ✓ Request-Syscheck-Internal (251ms)
      ✓ Request-Wmodules-Wmodules (270ms)
    PUT/cluster/:node_id/restart
      ✓ Request (worker) (253ms)
      ✓ Request (master) (257ms)


  115 passing (34s)

@davidjiglesias davidjiglesias requested a review from crd1985 March 17, 2020 10:49
@davidjiglesias davidjiglesias self-assigned this Mar 17, 2020
@davidjiglesias davidjiglesias changed the base branch from master to 3.12 March 17, 2020 10:50
@davidjiglesias davidjiglesias changed the title Fix /cluster/:node_id/statsremoted and /cluster/:node_id/stats/analysisd API calls Fix /cluster/:node_id/stats/remoted and /cluster/:node_id/stats/analysisd API calls Mar 17, 2020
Copy link
Contributor

@crd1985 crd1985 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the CHANGES.md

@davidjiglesias davidjiglesias requested a review from crd1985 March 17, 2020 11:11
@crd1985 crd1985 merged commit 21a13a3 into 3.12 Mar 17, 2020
@crd1985 crd1985 deleted the fix-470-cluster-stats branch March 17, 2020 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster API calls not working as intended
2 participants