Is there a command to get a list of all nodes in a cluster with their subscription key?

criva

New Member
May 13, 2024
10
0
1
We have a few hypervisors in a cluster and my sysadmin removed one without releasing the license.
Is there a way to get a list of server/server id/license keys from the proxmox shell?
On the license panel on the customer site I only see the key and it is pretty annoying to have to click and open many lines.

Of course one can script this but I was wondering if there is an out of the box solution, as it seems a pretty standard need.
thanks for the input.
 
no, there is no way to get that cluster wide. but `pvesubscription get` on each node should give you what you need (or flipping through the nodes in the UI after selecting the subscription panel ;))
 
  • Like
Reactions: criva
A very simple one-liner does it for me:
Code:
~# for HOST in hosta 2ndhost third; do echo "---------- $H:"; ssh $HOST " pvesubscription get "; done
:-)
 
  • Like
Reactions: criva
Thanks for your answers, I was fearing that two ways would be manually or with a (very small) script.
I was hoping at least than there was a secret way to give a HOST as argument of "pvesubscrption get" ;)
 
Style Nit : if one strings along multiple lines with ;, that stretches and defies the definition of "one-liner"
*grin* "One line" and "one command" are different things - for me. (And then this example is a single command, "for".)

But yeah, I've seen "one liners" with several hundred characters - that can be a hell to analyze...
 
  • Like
Reactions: gfngfn256
Thanks for your answers, I was fearing that two ways would be manually or with a (very small) script.
I was hoping at least than there was a secret way to give a HOST as argument of "pvesubscrption get" ;)
well, you can use `pvesh` in that case (or some other API client). although pvesh will just do ssh under the hood anyway ;)
 
This would be a one liner :cool:
Code:
pvesh get /cluster/resources --type node --output-format json|jq -r .[].node| xargs -I {} sh -c 'echo {}: $(pvesh get nodes/{}/subscription --output-format json | jq -r .message)'
pve-1: There is no subscription key
pve-2: There is no subscription key
pve-3: There is no subscription key



Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: UdoB
This would be a one liner :cool:
Great!
Small bug: with "jq -r .message" it fails, giving "pve-1: null" as result. With "jq -r .key" it lists succesfully all "pve-X: pve2c-licensekeys" :)

Only for completeness sake: a copy from above with "key":
Code:
pvesh get /cluster/resources --type node --output-format json|jq -r .[].node| xargs -I {} sh -c 'echo {}: $(pvesh get nodes/{}/subscription --output-format json | jq -r .key)'
 
  • Like
Reactions: bbgeek17