Using Xen Orchestra WebSocket API to Track VM Changes (Integration with Drata)
-
Hi everyone,
We're currently working on integrating our Xen Orchestra instance with Drata for automated asset tracking and compliance. As part of this setup, we're successfully using the REST API to fetch VM details like name_label, uuid, etc.
However, to keep our asset list up-to-date in near real-time, we're looking to leverage the WebSocket API provided by Xen Orchestra — specifically to detect when VMs are created or deleted.
A few questions:
Is there an officially supported way to subscribe to VM creation/deletion events over the WebSocket API?
Are there any watch* or subscribe* methods exposed for this purpose, or would polling with vm.list or xapi.getAllRecords over WebSocket be the recommended approach?
Are there any best practices or examples available for using the WebSocket API in this context?
Thanks in advance for your help — any guidance or documentation links would be greatly appreciated!
-
Hi,
Good question, let me ask @lsouai-vates

-
What about using a web hook to
vm.createandvm.delete? -
@arckhox Hello! I don't know if it is what you are looking for but in REST API doc I founded this:
https://github.com/vatesfr/xen-orchestra/blob/master/packages/xo-server/docs/rest-api.md#task-monitoring"A watch mode is available when fetching the collection as NDJSON by using both ndjson and watch query strings. Instead of sending the objects directly, each entry will be an array [event, object]. event can be either remove to mean that an object has been removed from the collection or update to mean that an object has been added to the collection or updated.
In case of the remove event, only the id properties of the deleted object is available.
The fields and filter parameters are supported."
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