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

Adapt wazuh-metrics and data-visualizer CLIs to handle multiprocessing #2278

Merged
merged 3 commits into from
Nov 30, 2021

Conversation

vicferpoy
Copy link
Contributor

Related issue
closes #2258

Description

After adding multiprocessing to the Wazuh cluster and API, we needed some changes on the monitoring tools to keep track of all child processes.

Configuration options

  • Wazuh metrics
    Configuration options remain the same. The CLI will look for all processes related to the given process name.

  • Data visualizer
    Configuration options remain the same as we need to pass every CSV file to it. As child processes have a custom suffix, each CSV file will be considered as a different daemon.

Logs

  • Running processes

    3 API processes and 3 cluster processes.

root@wazuh-master:/# ps -edf ww | egrep "clusterd|apid"

wazuh         70       1  0 09:47 ?        Sl     0:10 /var/ossec/framework/python/bin/python3 /var/ossec/api/scripts/wazuh-apid.py
wazuh        575       1  0 09:47 ?        Sl     0:07 /var/ossec/framework/python/bin/python3 /var/ossec/framework/scripts/wazuh-clusterd.py
wazuh        963     575  0 09:47 ?        S      0:01 /var/ossec/framework/python/bin/python3 /var/ossec/framework/scripts/wazuh-clusterd.py
wazuh        965     575  0 09:47 ?        S      0:01 /var/ossec/framework/python/bin/python3 /var/ossec/framework/scripts/wazuh-clusterd.py
wazuh       1695      70  0 09:57 ?        S      0:00 /var/ossec/framework/python/bin/python3 /var/ossec/api/scripts/wazuh-apid.py
wazuh       1698      70  0 09:57 ?        S      0:00 /var/ossec/framework/python/bin/python3 /var/ossec/api/scripts/wazuh-apid.py
  • After running wazuh-metrics
root@wazuh-master:/tmp# ll
total 20
drwxrwxrwt. 1 root root  234 Nov 25 09:57 ./
drwxr-xr-x. 1 root root  300 Nov 25 09:47 ../
drwxr-xr-x. 1 root root   54 Nov 25 09:57 process_metrics/
-rw-r--r--. 1 root root 3333 Nov 25 09:58 wazuh-apid.csv
-rw-r--r--. 1 root root 3743 Nov 25 09:58 wazuh-apid_child_1.csv
-rw-r--r--. 1 root root 3830 Nov 25 09:58 wazuh-apid_child_2.csv
-rw-r--r--. 1 root root 3620 Nov 25 09:58 wazuh-clusterd.csv
-rw-r--r--. 1 root root 4046 Nov 25 09:58 wazuh-clusterd_child_1.csv
-rw-r--r--. 1 root root 4130 Nov 25 09:58 wazuh-clusterd_child_2.csv
  • After running data-visualizer
root@wazuh-master:/tmp# data-visualizer -s /tmp/wazuh-apid.csv /tmp/wazuh-apid_child_1.csv /tmp/wazuh-apid_child_2.csv wazuh-clusterd.csv wazuh-clusterd_child_1.csv wazuh-clusterd_child_2.csv -t binary

image

Tests

  • Proven that tests pass when they have to pass.
  • Proven that tests fail when they have to fail.
  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • Python codebase is documented following the Google Style for Python docstrings.
  • The test is documented in wazuh-qa/docs.
  • provision_documentation.sh generate the docs without errors.

@vicferpoy vicferpoy self-assigned this Nov 26, 2021
Copy link
Contributor

@snaow snaow left a comment

Choose a reason for hiding this comment

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

Great job ^^

@snaow snaow merged commit 08ded39 into master Nov 30, 2021
@snaow snaow deleted the 2258-wazuh-metrics-multiprocesses branch November 30, 2021 22:57
@snaow snaow mentioned this pull request Jan 27, 2022
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.

Adapt Monitor class to allow child processes monitoring
3 participants