XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Webhooks in Xen Orchestra

    Scheduled Pinned Locked Moved Xen Orchestra
    18 Posts 7 Posters 2.3k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • olivierlambertO Offline
      olivierlambert Vates 🪐 Co-Founder CEO
      last edited by olivierlambert

      See this blog post: https://xen-orchestra.com/blog/webhooks-in-xen-orchestra

      This will be available in the next release. Please share your ideas/use cases here 🙂

      1 Reply Last reply Reply Quote 0
      • J Offline
        JCastang
        last edited by JCastang

        Hello,

        A use case can be "Chatbot" integration. So it could be great to pass data in requests using POST method.
        Do not know if it is already done, in screen there are not fields to add data parameters. (It seems to be URL parameters..)
        Our case will be to intergrate XOA notification in Nextcloud Talk via API and webhook. (Maybe an XOA plugin can be devellopped).

        Great feature indeed !

        1 Reply Last reply Reply Quote 0
        • olivierlambertO Offline
          olivierlambert Vates 🪐 Co-Founder CEO
          last edited by

          It's not complicated to do so 🙂 You need just a small relay somewhere to get the content of the hook and format it correctly for your own need.

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            JCastang @olivierlambert
            last edited by JCastang

            @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...

            pdoniasP 1 Reply Last reply Reply Quote 0
            • olivierlambertO Offline
              olivierlambert Vates 🪐 Co-Founder CEO
              last edited by

              Ping @pdonias

              1 Reply Last reply Reply Quote 0
              • pdoniasP Offline
                pdonias Vates 🪐 XO Team @JCastang
                last edited by

                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.

                J 1 Reply Last reply Reply Quote 0
                • AnonabharA Offline
                  Anonabhar
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Offline
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    XO already got an API you can request, since it exists 😉

                    AnonabharA 1 Reply Last reply Reply Quote 0
                    • AnonabharA Offline
                      Anonabhar @olivierlambert
                      last edited by

                      @olivierlambert LOL So its a case of RTFM for me then 8-)

                      1 Reply Last reply Reply Quote 0
                      • olivierlambertO Offline
                        olivierlambert Vates 🪐 Co-Founder CEO
                        last edited by

                        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 🙂

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          JCastang @pdonias
                          last edited by JCastang

                          @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/1879

                          It 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 XOA 😄

                          Anyway I would first implement a tiny PHP script to post messages in Nextcloud Talk as a first solution.

                          fti7 created this issue in nextcloud/spreed

                          closed Webhook Support / bot integration #1879

                          pdoniasP 1 Reply Last reply Reply Quote 0
                          • pdoniasP Offline
                            pdonias Vates 🪐 XO Team @JCastang
                            last edited by

                            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?

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              JCastang
                              last edited by

                              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)...

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                JCastang
                                last edited by

                                Hello,

                                Is that possible to add Frendly names in complement of UUID ? (Such as Job name or VM Name or SR Name) ?

                                Thanks !

                                pdoniasP 1 Reply Last reply Reply Quote 0
                                • pdoniasP Offline
                                  pdonias Vates 🪐 XO Team @JCastang
                                  last edited by pdonias

                                  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.

                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    djingo
                                    last edited by

                                    This post is deleted!
                                    1 Reply Last reply Reply Quote 0
                                    • exeticoE Offline
                                      exetico
                                      last edited by exetico

                                      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 better method 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 the runId, 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 from healthchecks.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 and failure 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.

                                      1 Reply Last reply Reply Quote 1
                                      • D Offline
                                        DustinB
                                        last edited by

                                        I'll be looking to setup webhooks to push backup logs to our SOC audit platform (tugboat), ideally on the weekly jobs.

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post