Skip to content

feat: enable various outputs (yaml, json) for clusterstatus #51

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ylmrx
Copy link
Contributor

@ylmrx ylmrx commented Mar 10, 2025

  • support output (-o format) option for clusterstatus
  • add a markdown table output (-o md) (kudos @abuisine suggestion)
  • py38-compat fixes

@ylmrx ylmrx marked this pull request as ready for review March 10, 2025 10:41
@ylmrx
Copy link
Contributor Author

ylmrx commented Mar 11, 2025

(pending py38 drop #53 , so i can remove the try/except)

@ylmrx ylmrx marked this pull request as draft March 11, 2025 15:15
@ylmrx ylmrx force-pushed the feat/enable_outputs_clusterstatus branch 2 times, most recently from adf5fa9 to 3c41e1f Compare March 18, 2025 10:10
@ylmrx ylmrx marked this pull request as ready for review March 18, 2025 10:10
@ylmrx ylmrx force-pushed the feat/enable_outputs_clusterstatus branch from 3c41e1f to 4499bd6 Compare March 18, 2025 10:17
Comment on lines +39 to +51
output = f"""\
Status: {status}
VMs: {vms - templates}
Templates: {templates}
Metrics:
CPU: {_get_cpu_output()}
Memory: {_get_memory_output()}
Disk: {_get_disk_output()}
Nodes:
Offline: {len([node for node in proxmox.nodes if node.status == NodeStatus.OFFLINE])}
Online: {len([node for node in proxmox.nodes if node.status == NodeStatus.ONLINE])}
Unknown: {len([node for node in proxmox.nodes if node.status == NodeStatus.UNKNOWN])}
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

In a sense we can argue that this provides a "better output", but in the other hand I was quite fine with the previous output. I feel like it was intentional to prepend every lines with a double space and start the output with a \n to clearly delimitate the output from previous logs (INFO:root:Proxmox cluster: XXX for instance).

Any thoughts about it @lcaflc?

@ylmrx ylmrx force-pushed the feat/enable_outputs_clusterstatus branch from 4499bd6 to 55b9757 Compare March 19, 2025 15:57
@ylmrx ylmrx force-pushed the feat/enable_outputs_clusterstatus branch from 55b9757 to 9092ef5 Compare March 19, 2025 15:59
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.

2 participants