Skip to content
Automatic snapshot tool for Proxmox VE
C# Batchfile Shell PowerShell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
src/Corsinvest.ProxmoxVE.AutoSnap
.gitignore
3rd-party-licenses.md
Corsinvest.ProxmoxVE.AutoSnap.sln Change licensing Oct 23, 2019
LICENSE.md Change licensing Oct 23, 2019
README.md
appveyor.yml Improev test Oct 23, 2019
gpl-3.0.txt
script-hook.bat Change licensing Oct 23, 2019
script-hook.sh

README.md

cv4pve-autosnap

License Release GitHub All Releases AppVeyor branch

Proxmox VE automatic snapshot tool

More information about cv4pve-autosnap

More information about Qemu guest agent

The old bash version inside Proxmox VE is no longer supported because the Proxmox VE developers continue to change output. The risk of incompatibility is high. With the new version that uses native APIs, the problem no longer exists

    ______                _                      __
   / ____/___  __________(_)___ _   _____  _____/ /_
  / /   / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
 / /___/ /_/ / /  (__  ) / / / / |/ /  __(__  ) /_
 \____/\____/_/  /____/_/_/ /_/|___/\___/____/\__/

 Corsinvest for Proxmox VE Auto Snapshot    (Made in Italy)

Usage: cv4pve-autosnap [options] [command]

Options:
  -?|-h|--help  Show help information
  --host        The host name host[:port]
  --username    User name <username>@<realm>
  --password    The password. Specify 'file:path_file' to store password in file.
  --version     Show version information
  --vmid        The id or name VM/CT comma separated (eg. 100,101,102,TestDebian)
                -vmid or -name exclude (e.g. -200, -TestUbuntu),
                'all-???' for all VM/CT in specific host (e.g. all-pve1, all-\$(hostname)),
                'all' for all VM/CT in cluster

Commands:
  clean         Remove auto snapshots
  snap          Will snap one time
  status        Get list of all auto snapshots

Run 'cv4pve-autosnap [command] --help' for more information about a command.

Copyright and License

Copyright: Corsinvest Srl For licensing details please visit LICENSE.md

Commercial Support

This software is part of a suite of tools called cv4pve-tools. If you want commercial support, visit the site

Introduction

Automatic snapshot for Proxmox VE with retention.

In this version the tool works outside the Proxmox VE host using the API. The reasons are:

  • if the host does not work the tool does not work
  • using the API, future changes are guaranteed
  • Root access is not required, a user is required to perform the operation
  • use of standard https / https json technology

For the planning process using an external machine:

Docker crontab

Docker crontab with ui

Main features

  • Completely written in C#
  • Use native Api REST Proxmox VE (library C#)
  • Independent os (Windows, Linux, Macosx)
  • Installation rapid, unzip file extract binary
  • Not require installation in Proxmox VE
  • Execute out side Proxmox VE
  • For KVM and LXC
  • Work for single node or cluster, automatically resolve VM/CT id/name
  • Use id or name with --vmid parameter
  • Can keep multiple snapshots --keep
  • Clean all snapshots
  • Multiple schedule VM/CT using --label (es. daily,monthly)
  • Hook script
  • Multiple VM/CT (100,102,ubuVm,debVm,pipperoVm,fagianoVm or all) in a single execution
  • Exclusion specific VM/CT using minus e.g --vmid=all,-100
  • Exclusion template from snapshot
  • Waiting for the snapshot process to finish
  • Alerting in QEMU, agent not enabled.
  • Save memory VM Qemu in snap using parameter --state.
  • No stop on error

Configuration and use

E.g. install on linux 64

Download last package e.g. Debian cv4pve-autosnap-linux-x64.zip, on your os and install:

root@debian:~# unzip cv4pve-autosnap-linux-x64.zip

This tool need basically no configuration.

Snapshot a VM/CT one time

root@debian:~# cv4pve-autosnap --host=192.168.0.100 --username=root@pam --password=fagiano --vmid=111 snap --label='daily' --keep=2

This command snap VM 111.

root@debian:~# cv4pve-autosnap --host=192.168.0.100 --username=root@pam --password=fagiano --vmid="all,-111" snap --label='daily' --keep=2

This command snap all VMs except 111.

The --keep tells that it should be kept 2 snapshots, if there are more than 2 snapshots, the 3 one will be erased (sorted by creation time). The --state save memory VM.

Clean a VM/CT one time

root@debian:~# cv4pve-autosnap --host=192.168.0.100 --username=root@pam --password=fagiano --vmid=111 clean --label='4hours' --keep=2
----- VM 100 -----
Remove snapshot: auto4hours190617080002
Remove snapshot: auto4hours190617120002
Remove snapshot: auto4hours190617160002
Remove snapshot: auto4hours190617200002

Status snapshots

root@debian:~# cv4pve-autosnap --host=192.168.0.100 --username=root@pam --password=fagiano --vmid=100 status

┌──────┬─────┬───────────────────┬──────────────────────────────┬──────────────────────────────┬─────────────────┬─────┐
│ NODE │ VM  │ TIME              │ PARENT                       │ NAME                         │ DESCRIPTION     │ RAM │
├──────┼─────┼───────────────────┼──────────────────────────────┼──────────────────────────────┼─────────────────┼─────┤
│ pve1 │ 100 │ 19/08/28 09:21:35 │ no-parent                    │ auto4hours190828112133       │ cv4pve-autosnap │     │
│ pve1 │ 100 │ 19/08/28 12:23:09 │ auto4hours190828112133       │ auto4hours190828142307       │ cv4pve-autosnap │     │
│ pve1 │ 100 │ 19/08/29 06:50:23 │ auto4hours190828142307       │ auto4hours190829085021       │ cv4pve-autosnap │     │
│ pve1 │ 100 │ 19/08/29 07:32:15 │ auto4hours190829085021       │ auto4hours190829093214       │ cv4pve-autosnap │     │
└──────┴─────┴───────────────────┴──────────────────────────────┴──────────────────────────────┴─────────────────┴─────┘

Output type:

-o|--output   Type output (default: text) Text,Json,JsonPretty

Hook script

Before run hook script, program create environment variable:

CV4PVE_AUTOSNAP_PHASE
CV4PVE_AUTOSNAP_VMID
CV4PVE_AUTOSNAP_VMTYPE
CV4PVE_AUTOSNAP_LABEL
CV4PVE_AUTOSNAP_KEEP
CV4PVE_AUTOSNAP_SNAP_NAME
CV4PVE_AUTOSNAP_VMSTATE     #1/0
CV4PVE_AUTOSNAP_DEBUG       #1/0
CV4PVE_AUTOSNAP_DRY_RUN     #1/0

See example hook file script-hook.bat, script-hook.sh

You can’t perform that action at this time.