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

    search for snapshots sorted by creation date

    Scheduled Pinned Locked Moved Xen Orchestra
    13 Posts 5 Posters 1.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.
    • DanpD Offline
      Danp Pro Support Team
      last edited by

      I haven't seen a way to do this from within XO. However, you can gather the details using xe on the command line --

      for i in `xe snapshot-list  | grep uuid | awk '{print$5}'`; do export j=$(xe snapshot-param-get uuid=$i  param-name=children); k=$(xe snapshot-param-get uuid=$i  param-name=snapshot-time); echo "VM UUID: $j - Snapshot UUID: $i - Creation Time: $k"; done
      

      This doesn't sort the results, so you will need to do that in Excel or your favorite text editor.

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

        I think that should be doable with our REST API or at worst our existing API. Pinging @julien-f

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          Steve_Sibilia @olivierlambert
          last edited by

          @olivierlambert We are interested in that too. Any news?

          It would be a wonderful integration to our icinga check for snapshots.

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

            I think it's now possible since last release. Let me ping @julien-f

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              Steve_Sibilia @olivierlambert
              last edited by

              @olivierlambert Thank you.

              julien-fJ 1 Reply Last reply Reply Quote 0
              • julien-fJ Offline
                julien-f Vates 🪐 Co-Founder XO Team @Steve_Sibilia
                last edited by julien-f

                Hello,

                Yes, the list of VM snapshots in now exposed by the REST API, the path is /rest/v0/vm-snapshots.

                The list of available collections is under the path /rest/v0.

                More info in the documentation: https://xen-orchestra.com/docs/restapi.html

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  Steve_Sibilia @julien-f
                  last edited by

                  @julien-f thank you.
                  Is it possible to filter by creation date?

                  julien-fJ 1 Reply Last reply Reply Quote 0
                  • julien-fJ Offline
                    julien-f Vates 🪐 Co-Founder XO Team @Steve_Sibilia
                    last edited by julien-f

                    @Steve_Sibilia Yes.

                    1. Take a look at a specific snapshot to see the available fields, note snapshot_time which is a Unix timestamp.
                    2. Use a filter (syntax documentation), example:
                      /rest/v0/vm-snapshots?filter=snapshot_time%3A>1669044124
                      
                    1 Reply Last reply Reply Quote 1
                    • V Offline
                      vmpr @Steve_Sibilia
                      last edited by

                      @Steve_Sibilia hey, what icinga check are you using for snapshots? do you have any xcp-ng related icinga checks running?

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        Steve_Sibilia @vmpr
                        last edited by

                        @vmpr Hi, i wrote my own to find any vm with more than X snapshot which has an age of Y days.

                        If you are interested I can share it, I need a little bit of time to translate comments and help in english.

                        For xcp-ng i wrote onther check to get the size of hba storage SR's.

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

                          Any helper and use case is welcome, feel free to link to your Github or Gitlab repository!

                          S 1 Reply Last reply Reply Quote 0
                          • S Offline
                            Steve_Sibilia @olivierlambert
                            last edited by

                            @olivierlambert here it is: https://github.com/Stevesibilia/check_snapshot

                            Keep in mind i'm not a developer 😄

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