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

ENH: Add monitoring script to collect information about VMs in different states #128

Merged
merged 10 commits into from
Feb 20, 2024

Conversation

meoflynn
Copy link
Contributor

@meoflynn meoflynn commented Feb 2, 2024

Adds a new script for collecting information about VMs in different states with unit tests

Added a script for collecting the status of VMs and unit tests.
One unit test is still being developed.
@meoflynn meoflynn changed the title ENH: Add monitoring script to collect information about VMs in different states [WIP] ENH: Add monitoring script to collect information about VMs in different states Feb 2, 2024
@anish-mudaraddi anish-mudaraddi marked this pull request as draft February 2, 2024 15:38
Update the main method for collecting stats and add a test for checking
an error is raised if a param is missing.
Add limit=10000 param to server queries to search across all projects
and to get all servers that match query to be returned
Corrected package import and added missing docstring
Copy link
Collaborator

@anish-mudaraddi anish-mudaraddi left a comment

Choose a reason for hiding this comment

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

I haven't looked through your tests yet - but I've made comments on how you can use the stuff I already wrote to automatically post to influxdb

MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
@anish-mudaraddi
Copy link
Collaborator

Also you'll want to move your test file into the tests folder /MonitoringScripts/tests so the CI/CD will run them

Copy link
Member

@khalford khalford left a comment

Choose a reason for hiding this comment

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

Looks good. Just a few comments

MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
MonitoringTools/usr/local/bin/collect_vm_stats.py Outdated Show resolved Hide resolved
meoflynn and others added 5 commits February 13, 2024 09:15
Updated the script based on the changes requested.
Includes having a separate method to read the length of the generator
object returned by the openstack query and some updates to formatting
and unit tests
Add main method so the script can be run to collect data for an influxDB
instance
queries were failing on prod because we were asking for too many servers with one call. Implemented a helper function to handle pagination for us
move tests to test folder and convert them to pytest tests
add test for main and get_all_server_statuses
@codecov-commenter
Copy link

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (1e56165) 97.93% compared to head (e529f4b) 98.45%.
Report is 42 commits behind head on master.

Files Patch % Lines
MonitoringTools/usr/local/bin/collect_vm_stats.py 90.47% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #128      +/-   ##
==========================================
+ Coverage   97.93%   98.45%   +0.51%     
==========================================
  Files          50       12      -38     
  Lines        1844      842    -1002     
==========================================
- Hits         1806      829     -977     
+ Misses         38       13      -25     
Flag Coverage Δ
rabbit_consumer ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anish-mudaraddi
Copy link
Collaborator

anish-mudaraddi commented Feb 19, 2024

fixed a bug and added fixed tests

These scripts are now working with prod

I'm not going for full test coverage for run_server_query because this functionality is replicated with the query library.
We will eventually move these scripts to stackstorm or get them using the query library, so we won't need to bugfix pagination problems in the future (on this script).

@anish-mudaraddi anish-mudaraddi marked this pull request as ready for review February 19, 2024 13:13
@anish-mudaraddi anish-mudaraddi changed the title [WIP] ENH: Add monitoring script to collect information about VMs in different states ENH: Add monitoring script to collect information about VMs in different states Feb 19, 2024
add return type and docstring to run_server_query
@anish-mudaraddi anish-mudaraddi merged commit e4430a0 into master Feb 20, 2024
3 checks passed
@khalford khalford deleted the vm-status-monitoring branch September 19, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants