Webhooks in Xen Orchestra
-
@olivierlambert Yes already plan to do that.
But my question (Asked to myself) was "How to pass a semi-long message as parameter in web url?"
(Chat message containing spaces).
It seemed to me easier to pass data in POST request.But I may fool myself on this subject...
-
Ping @pdonias
-
Hi @JCastang, what kind of data would you like to pass? Static data? Because all the dynamic data we could think of is already sent in the request body.
-
I was wondering if the other direction would be possible? (Sending a request to XO to perform a task).
IE: If there was a power failure and our UPS's are active, we could send a task to XO to start shutting down VM's so the VHD's are clean in the SAN's and protect the data?
~Peg
-
XO already got an API you can request, since it exists
-
@olivierlambert LOL So its a case of RTFM for me then 8-)
-
A good way to play with it, is to use
xo-cli
. It exposes all the function/query you can make via the API, without having to write something yourself.Then if you need to call the API directly, you know what to call
-
@pdonias Oh great ! I haven't seen this documentation. Nice !
The only thing I need now is a wrapper to format thing as an Nextcloud Talk API handler.I am wondering if this could be integrated as a module in XOA...
Reading this https://github.com/nextcloud/spreed/issues/1879It seems that we could implement a quick script to post (dirty way anyway using login/password) message.
Could be great if wrapper could be implemented directly in XOAAnyway I would first implement a tiny PHP script to post messages in Nextcloud Talk as a first solution.
-
Could be great if wrapper could be implemented directly in XOA
Like a generic configurable wrapper in XO for any webhook target? How do you imagine it?
-
Hum...
Maybe like other plugins "transport-XXXX".
It may be a bit far from "webhooks" but a plugin to handle "notifications" on events.We can image that webhook plugin can expose "events" (such as vm.start) and associated actions: webhook call or a plugin call to handle event.
Use case:
"Someone trigger vm.start" -> Webhook plugin catches event -> Push this event to a plugin via a method call -> The plugin extracts and format data -> And then pushes it to the ending service (In my case Nextcloud API).As for now we can do it via a web call on a micro service that will translate data. (Few lines of code in the link of my previous post)
But intergrate it as an integrate transport call could be great.
In such way, a vm.start action can trigger an email too (for example)... -
Hello,
Is that possible to add Frendly names in complement of UUID ? (Such as Job name or VM Name or SR Name) ?
Thanks !
-
For now, all you get in the webhook request are the API call parameters and result (and a few other things). This is a generic behaviour that doesn't depend on what the call does. If you need some more specific information, your webhook handler can, for example, make a call to XO's API to fetch that information.
-
This post is deleted! -
I'm trying to make a webhook which only fires, if my backup has been made properly (
success
, without errors). Is that possible?backupNg.runJob
does fire, but at all actions. Are there a bettermethod hook
I can use? I'm not been able to track a more suitable method, yet.Have I missed a detail, or is that not possible right now?
The
backup-reports
allows me to device therunId
, but I'd like to have a webhook even every-time things go as planned (as I've like to integrate the reporting into the service fromhealthchecks.io
).Another workaround would be to have the backup job fire a postpone script or similar, allowing me to customize it (if the proper amount of data was available), or have a postpone script for both
success
andfailure
for each job.Healthcheck does support filtering of the payload received, but only for emails, though. And I'd like to get it working with webhooks, if possible.
-
I'll be looking to setup webhooks to push backup logs to our SOC audit platform (tugboat), ideally on the weekly jobs.