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 2.2k 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.
    • V Offline
      vmpr
      last edited by

      Hi everyone, I am looking for a way to find snapshots in my pool that are pretty old so I can remove them. finding the "type" snapshot is not complicated but seeing the creation date and sorting them by that is my actual problem, is there a way for that?
      cheers Ringo

      1 Reply Last reply Reply Quote 0
      • 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

                              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
                              • First post
                                Last post