Skip to content

Perf And Metric Validation#42

Open
c-kr wants to merge 1 commit intoConSol-Monitoring:mainfrom
c-kr:perf-metric-validation
Open

Perf And Metric Validation#42
c-kr wants to merge 1 commit intoConSol-Monitoring:mainfrom
c-kr:perf-metric-validation

Conversation

@c-kr
Copy link
Copy Markdown

@c-kr c-kr commented Apr 18, 2026

Perf And Metric Validation

Summary

This patch fixes several cases where invalid or unusable input was not surfaced correctly:

  • perf now validates --perfcounter format before any network connection.
  • datastores and vm-guestfs now reject invalid --metric values at argument parsing time.

Files

  • checkvsphere/vcmd/perf.py
  • checkvsphere/vcmd/datastores.py
  • checkvsphere/vcmd/vmguestfs.py

Quick Verification

export PYTHONPATH="$PWD"
export VC_HOST='vcenter.example.com'
export VC_USER='[email protected]'
export VC_PASS='secret'
export ESX_HOST='esx1.example.com'
export VM_NAME='examplevm'

1. Invalid --metric for datastores

python -m checkvsphere.cli datastores -s dummy -u dummy -p dummy --metric usgae
echo $?

Expected before fix:

  • argument accepted
  • command proceeds until connection handling

Expected after fix:

  • argparse rejects usgae as invalid choice before any connection attempt

2. Invalid --metric for vm-guestfs

python -m checkvsphere.cli vm-guestfs -s dummy -u dummy -p dummy --vm-name dummy --metric usgae
echo $?

Expected before fix:

  • argument accepted
  • command proceeds until connection handling

Expected after fix:

  • argparse rejects usgae as invalid choice before any connection attempt

3. Invalid --perfcounter format

python -m checkvsphere.cli perf -s dummy -u dummy -p dummy --vimtype HostSystem --perfcounter broken
echo $?

Expected before fix:

  • command attempts a connection before failing

Expected after fix:

  • rc=3
  • output reports invalid groupName:perfName:rollupType format without trying to connect

@c-kr c-kr force-pushed the perf-metric-validation branch from 5e12552 to 4ce2e74 Compare April 22, 2026 08:22
@c-kr c-kr force-pushed the perf-metric-validation branch from 4ce2e74 to add1a1f Compare April 22, 2026 08:50
@c-kr c-kr marked this pull request as ready for review April 22, 2026 09:33
@c-kr c-kr changed the title Validate metric arguments and missing instances Perf And Metric Validation Apr 22, 2026
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.

1 participant