search for snapshots sorted by creation date
-
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 -
I haven't seen a way to do this from within XO. However, you can gather the details using
xeon 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"; doneThis doesn't sort the results, so you will need to do that in Excel or your favorite text editor.
-
I think that should be doable with our REST API or at worst our existing API. Pinging @julien-f
-
@olivierlambert We are interested in that too. Any news?
It would be a wonderful integration to our icinga check for snapshots.
-
I think it's now possible since last release. Let me ping @julien-f
-
@olivierlambert Thank you.
-
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
-
@julien-f thank you.
Is it possible to filter by creation date? -
@Steve_Sibilia Yes.
- Take a look at a specific snapshot to see the available fields, note
snapshot_timewhich is a Unix timestamp. - Use a filter (syntax documentation), example:
/rest/v0/vm-snapshots?filter=snapshot_time%3A>1669044124
- Take a look at a specific snapshot to see the available fields, note
-
@Steve_Sibilia hey, what icinga check are you using for snapshots? do you have any xcp-ng related icinga checks running?
-
@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.
-
Any helper and use case is welcome, feel free to link to your Github or Gitlab repository!
-
@olivierlambert here it is: https://github.com/Stevesibilia/check_snapshot
Keep in mind i'm not a developer

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