Skip to content

Commit

Permalink
Merge pull request #5007 from wazuh/enhancement/5006-fix-wazuhdb-stat…
Browse files Browse the repository at this point in the history
…s-API-parsing

Fix wazuhdb stats API parsing
  • Loading branch information
davidjiglesias authored Feb 23, 2024
2 parents 735ec8b + 5e9849e commit e021b1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ All notable changes to this project will be documented in this file.

### Changed

- Fix wazuhdb API statistics parsing ([#5007](https://github.com/wazuh/wazuh-qa/pull/5007)) \- (Framework)
- Enhance StatisticMonitor with API support ([#4970](https://github.com/wazuh/wazuh-qa/pull/4970)) \- (Framework)
- Deactivate tests and update vulnerability-detector configuration ([#4784](https://github.com/wazuh/wazuh-qa/pull/4784)) \- (Framework + Tests)
- Fix body format for get_api_token ([#4797](https://github.com/wazuh/wazuh-qa/pull/4797)) \- (Framework)
- Fix one_manager_agent_env pytest marker for System Tests ([#4782](https://github.com/wazuh/wazuh-qa/pull/4782)) \- (Tests)
Expand Down
18 changes: 10 additions & 8 deletions deps/wazuh_testing/wazuh_testing/tools/performance/statistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def __init__(self, target='agent', time_step=5, dst_dir=gettempdir(), use_state_
self.daemon = 'wazuh-analysisd'
elif self.target == 'wazuhdb':
self.daemon = 'wazuh-db'
self.use_state_file = False
logger.warning("Wazuhdb stat monitoring from State File is not supported. Will get data from API.")
else:
raise ValueError(f'The target {self.target} is not a valid one.')

Expand Down Expand Up @@ -341,12 +343,12 @@ def _write_csv(self, data, target, csv_file):
"{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},"+
"{36},{37},{38},{39},{40},{41},{42},{43},{44},{45},{46},{47},{48},{49},{50},{51},{52},"+
"{53},{54},{55},{56},{57},{58},{59},{60},{61},{62},{63},{64},{65},{66},{67},{68},{69},"+
"{70},{71},{72},{73},{74},{75},{76},{77},{78},{79},{70},{71},{72},{73},{74},{75},{76},"+
"{77},{78},{79},{80},{81},{82},{83},{84},{85},{86},{87},{88},{89},{90},{91},{92},{93},"+
"{94},{95},{96},{97},{98},{99},{100},{101},{102},{103},{104},{105},{106},{107},{108},"+
"{109},{110},{11},{111},{112},{113},{114},{115},{116},{117},{118},{119},{120},{121},"+
"{122},{123},{124},{125},{126},{127},{128},{129},{130},{131},{132},{133},{134},{135},"+
"{136},{137},{138},{139},{140},{141},{142},{143},{145},{146},{147},{148}\n").format(
"{70},{71},{72},{73},{74},{75},{76},{77},{78},{79},{80},{81},{82},{83},{84},{85},{86},"+
"{87},{88},{89},{90},{91},{92},{93},{94},{95},{96},{97},{98},{99},{100},{101},{102},"+
"{103},{104},{105},{106},{107},{108},{109},{110},{111},{112},{113},{114},{115},{116},"+
"{117},{118},{119},{120},{121},{122},{123},{124},{125},{126},{127},{128},{129},{130},"+
"{131},{132},{133},{134},{135},{136},{137},{138},{139},{140},{141},{142},{143},{144},"+
"{145},{146},{147},{148}\n").format(
timestamp, # 0
data['timestamp'], # 1
interval, # 2
Expand Down Expand Up @@ -592,9 +594,9 @@ def start(self):
"""Start the monitoring threads."""
self.run()
if self.use_state_file:
logger.info(f'Started monitoring statistics from API for {self.target}')
else:
logger.info(f'Started monitoring statistics from {self.statistics_file}')
else:
logger.info(f'Started monitoring statistics from API for {self.target}')


def shutdown(self):
Expand Down

0 comments on commit e021b1b

Please sign in to comment.