Align monitoring exit codes and about error handling#41
Open
c-kr wants to merge 1 commit intoConSol-Monitoring:mainfrom
Open
Align monitoring exit codes and about error handling#41c-kr wants to merge 1 commit intoConSol-Monitoring:mainfrom
c-kr wants to merge 1 commit intoConSol-Monitoring:mainfrom
Conversation
a753ee3 to
6177be0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Return Codes And CLI Validation
Summary
This patch aligns top-level CLI handling and parser exits with the Monitoring Plugins guidelines:
--helpand "no command supplied" now returnUNKNOWN (3)instead ofOK (0).UNKNOWN (3).ConnectionRefusedErrornow reportsCRITICALin both text and exit code.aboutno longer maps unexpected plugin-internal exceptions toCRITICAL; normal check results stay unchanged, but unexpected internal failures now surface asUNKNOWN.Reference:
The relevant guideline points are:
UNKNOWN (3)--help/--versionshould returnUNKNOWN (3)CRITICALFiles
checkvsphere/tools/cli.pycheckvsphere/cli.pycheckvsphere/vcmd/about.pyQuick Verification
1. No command supplied
Expected before fix:
rc=0Expected after fix:
rc=32. Subcommand help
Expected before fix:
rc=0Expected after fix:
rc=33. Connection refused text/code mismatch
Expected before fix:
rc=2UNKNOWN - Connection refusedExpected after fix:
rc=2CRITICAL - Connection refused4. about internal error classification
This check needs a reachable vCenter. Point
--sessionfileto a directory so writing the session ID fails after login:Expected before fix:
rc=2aboutare reported asCRITICALExpected after fix:
rc=3UNKNOWNAssisted-by: Codex gpt-5.4 high