-
Hi,
I was wondering if we could get a REST API Endpoint to discover vms via the prometheus build-in http_sd?
As a starting point it would be nice the get the ips and pool association of vms through the
/vmscall so that it would be possible to write a wrapper script to match the http_sd format.Or is this possible and I haven't found the correct fields yet?

Cheers,
Jan -
Hi,
Can you be more specific? I never heard about
http_sd
-
@olivierlambert sure its a new service discovery plugin in the prometheus core which scrapes http endpoints:
https://prometheus.io/docs/prometheus/latest/http_sd/It requires this json format:
[ { "targets": [ "<host>", ... ], "labels": { "<labelname>": "<labelvalue>", ... } }, ... ] -
@julien-f do you think it's something doable at some point?
-
@olivierlambert As said, I would be a starting point if the fields of the
/vmscall will be extended to include ipaddesses, pool_name/id and maybe host_affinity -
I think it's already the case if you add the value in the query string
(but I might be wrong). That's why I'm asking @julien-f ^^ -
Here is what you asked:
curl -b authenticationToken=xxxbak 'http://xxxx/rest/v0/vms/?fields=name_label,%24pool,addresses,affinityHost'Which is returning this for me:
{ "name_label": "XOA 🎷", "$pool": "xxxxxxxx-xxxx-xxxx-xxxx-2c519aa297e7", "mainIpAddress": "192.168.x.x", "addresses": { "0/ipv4/0": "192.168.x.x", "0/ipv6/0": "fe80::xxxx:xxxx:xxxx:xxxx" }, "affinityHost": "xxxxxxxx-xxxx-xxxx-xxxx-0dc8858f6686", "href": "/rest/v0/vms/xxxxxxxx-xxxx-xxxx-xxxx-a7a9306b347b" }Note:
affinityHostis missing if it's not set.Note 2: you can use
mainIpAddressfield, which is the helper showing the first IP address visible from the tools. -
Also, please keep us posted on this, I'm curious about the outcome and your use case
It's an interesting way of leveraging our API! -
@olivierlambert Uh very nice
now I got something to play with in the evening
I'll let you know once I've created a PoC -

-
J julien-f moved this topic from Xen Orchestra on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login