I am currently using the Corsinvest.ProxmoxVE.Api  powershell module to do API calls to Proxmox to get all nodes and all VMs which I then publish on an internal web site for engineers to see.
One challenge I have is looking at Cluster information.
I use the 'Get-PveClusterStatus' to get the name of cluster(s) .. and that is using the API endpoint '/cluster/status'
My command is as follows :
	
	
	
		
and that output of $clusterData looks like:
	
	
	
		
And in JSON format it looks like this :
	
	
	
		
This is fine when there is only one cluster. I can get the the cluster name and node names with :
	
	
	
		
However if I have more than one cluster, the output of $clusterData would be cluster, nodes, cluster nodes.
So basically
PVECLUSTER01
sfpmx04
sfpmx06
PVECLUSTER02
sfpmx07
sfpmx08
sfpmx049
This output is one array. Each is a separate item in the array and has a 'type' of cluster or node. But there is no identifier on a node to say which cluster it belongs to.
So I was thinking to get around that, I would first get the clusters, the way I got $clusterName above, and then say for each $cluster in $clustername use an API endpoint that points at a specific cluster, if there is such a thing .. but I cannot find it.
the endpoint could be
'/cluster/status/$cluster'
of
'/cluster/status/$clusterID'
This isn't a question about the Corsinvest.ProxmoxVE.Api module. I can use raw API calls to endpoints if I can get help finding the right endpoint.
thanks
				
			One challenge I have is looking at Cluster information.
I use the 'Get-PveClusterStatus' to get the name of cluster(s) .. and that is using the API endpoint '/cluster/status'
My command is as follows :
		Code:
	
	$clusterData = (Get-PveClusterStatus).response.data
	and that output of $clusterData looks like:
		Code:
	
	type    : cluster
quorate : 1
name    : PVECLUSTER01
nodes   : 5
id      : cluster
version : 19
type   : node
nodeid : 1
local  : 0
level  :
online : 1
ip     : 10.180.8.22
id     : node/sfpmx04
name   : sfpmx04
level  :
name   : sfpmx06
online : 1
id     : node/sfpmx06
ip     : 10.180.8.8
type   : node
nodeid : 3
local  : 0
	And in JSON format it looks like this :
		Code:
	
	[
  {
    "id": "cluster",
    "version": 19,
    "name": "PVECLUSTER01",
    "nodes": 5,
    "quorate": 1,
    "type": "cluster"
  },
  {
    "level": "",
    "id": "node/sfpmx04",
    "ip": "10.180.8.22",
    "online": 1,
    "name": "sfpmx04",
    "type": "node",
    "local": 0,
    "nodeid": 1
  },
  {
    "nodeid": 3,
    "local": 0,
    "type": "node",
    "name": "sfpmx06",
    "online": 1,
    "id": "node/sfpmx06",
    "ip": "10.180.8.8",
    "level": ""
  }
]
	This is fine when there is only one cluster. I can get the the cluster name and node names with :
		Code:
	
	$clusterName = ($clusterData | where {$_.type -eq "cluster"}).name
$nodeNames = ($clusterdata | where {$_.type -eq "node"}).name
	However if I have more than one cluster, the output of $clusterData would be cluster, nodes, cluster nodes.
So basically
PVECLUSTER01
sfpmx04
sfpmx06
PVECLUSTER02
sfpmx07
sfpmx08
sfpmx049
This output is one array. Each is a separate item in the array and has a 'type' of cluster or node. But there is no identifier on a node to say which cluster it belongs to.
So I was thinking to get around that, I would first get the clusters, the way I got $clusterName above, and then say for each $cluster in $clustername use an API endpoint that points at a specific cluster, if there is such a thing .. but I cannot find it.
the endpoint could be
'/cluster/status/$cluster'
of
'/cluster/status/$clusterID'
This isn't a question about the Corsinvest.ProxmoxVE.Api module. I can use raw API calls to endpoints if I can get help finding the right endpoint.
thanks