[SOLVED] Custom dashboard

Emilia

Member
Jan 12, 2020
4
0
6
I am working on a custom dashboard utilizing the Proxmox API to manage virtualization services.
But the thing is that to manage a vm I have to know on which proxmox node it's located from my understanding (I haven't tested this since I'm only running a single node)
My issue is that a vm might move to a different node if the original node goes down for example.
So storing which node it's on before if moves wouldn't help in this case since it might happen through some other means than my dashboard.
My question in turn is what would be a way for me to tackle this problem?
 
First, you will need to build a way to query any node in the cluster, since there is no "central" floating IP. You can have you dashboard probe cluster members one by one until one replies.
Then, you can just "get /cluster/resources" and extract data needed. Whether you do it before each call or cache until one of the management commands fails is a matter of implementation that only you can decide.


Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: Emilia
technically you only ever need to connect to one node (almost every API endpoint can be transparently proxied to every node by every node), but you need to know which node a guest belongs to for many guest-related operations since the node is part of the endpoint path (and used to proxy before handling the request if necessary).

so if you have guest 100 on node A, and guest 200 on node B, and an "empty" third node C, you can manage both guests by connecting to any of the three nodes, but you need the info where each guest is to construct the API paths. the cluster resources API call is the way to query this (it's also how the GUI does it - it polls this in the background every N seconds, which is why you sometimes have a slight delay between starting a guest and that status being reflected in the tree on the left side of the GUI ;)).

basically, endpoints starting with /cluster are handled directly by any node. endpoints starting with /nodes are handled by the node indicated in the path, and if you are querying them by connecting to another node, the request will be proxied automatically
 
  • Like
Reactions: Emilia
Both of your replies helps a lot. I've got a good understanding of how I want to implement this now so thank you both for your replies!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!