corsinvest / cv4pve-autosnap Goto Github PK
View Code? Open in Web Editor NEWAutomatic snapshot tool for Proxmox VE
Home Page: https://www.corsinvest.it/cv4pve
License: GNU General Public License v3.0
Automatic snapshot tool for Proxmox VE
Home Page: https://www.corsinvest.it/cv4pve
License: GNU General Public License v3.0
Hi,
I try to run the tool locally on my Proxmox server but I am running in connection issues.
This is what I have tried:
/usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=snap@pve --password=pwd --vmid=all snap --label='daily' --keep=7
/usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=snap@pve --password=pwd --vmid=all snap --label='weekly' --keep=4
/usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=snap@pve --password=pwd --vmid=all snap --label='monthly' --keep=2
/usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=root@pam --password=pwd --vmid=all snap --label='daily' --keep=7
/usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=root@pam --password=pwd --vmid=all snap --label='weekly' --keep=4
/usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=root@pam --password=pwd --vmid=all snap --label='monthly' --keep=2
Everytime I get an "Problem connection!" message.
I also tried to use localhost or the regular IP.
Hi,
First of all, I would like to thank you guys for your work on this very useful script.
I've noticed recently that the "cv4pve_autosnap" has stopped removing old snapshots based on the "--keep" option. It seems that it has no effect.
Here is the command I'm running:
`cv4pve-autosnap snap --vmid=514 --label='24hours' --keep=2
2019-09-02 23:26:11 DEBUG: cv4pve-autosnap 0.1.11
2019-09-02 23:26:11 DEBUG: Command line: snap --vmid=514 --label=24hours --keep=2
2019-09-02 23:26:11 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_PHASE: snap-job-start
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_VMID: 514
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_VMTECNOLOGY:
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_LABEL: 24hours
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_KEEP: 2
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_VMSTATE: 0
2019-09-02 23:26:11 DEBUG: CV4PVE_AUTOSNAP_SNAP_NAME: -
2019-09-02 23:26:11 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:12 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_PHASE: snap-create-pre
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_VMID: 514
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_VMTECNOLOGY: qm
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_LABEL: 24hours
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_KEEP: 2
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_VMSTATE: 0
2019-09-02 23:26:12 DEBUG: CV4PVE_AUTOSNAP_SNAP_NAME: auto24hours190902232611
2019-09-02 23:26:12 DEBUG: ------------------------------------------------------------
VM 514 - Creating snapshot auto24hours190902232611
2019-09-02 23:26:12 DEBUG: qm snapshot 514 auto24hours190902232611 -description 'cv4pve-autosnap'
2019-09-02 23:26:14 DEBUG: return 0
2019-09-02 23:26:14 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_PHASE: snap-create-post
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_VMID: 514
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_VMTECNOLOGY: qm
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_LABEL: 24hours
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_KEEP: 2
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_VMSTATE: 0
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_SNAP_NAME: auto24hours190902232611
2019-09-02 23:26:14 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:14 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_PHASE: snap-job-end
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_VMID: 0
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_VMTECNOLOGY:
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_LABEL: 24hours
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_KEEP: 2
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_VMSTATE: 0
2019-09-02 23:26:14 DEBUG: CV4PVE_AUTOSNAP_SNAP_NAME: -
2019-09-02 23:26:14 DEBUG: ------------------------------------------------------------
2019-09-02 23:26:14 DEBUG: Execution: 3 sec.`
It creates a new snapshot but it never deletes.
Thanks a lot for your help.
Hi. After latest updates installation from no-subscription repository no snapshots are deleted after "eve4pve-autosnap snap" execution with "keep" parameter enabled. Checked log files and there are only snapshot creation entries, no errors.
On Proxmox machine with enterprise repository everything works like it should.
Hi there,
we've a problem with cv4pve-autosnap after upgrading to Proxmox v6.0.7 (coming from 5.4.13 that was working perfectly).
When we try to do anything, even just using "status" command, we get an exception error. We attach ths error here below.
errore cv4pve.txt
Best regards,
Paolo
Hello,
what is the best way to upgrade from eve4pve to cv4pve ?
We have a multi node cluster and i have notice eve4pve doas'nt delete old snap any more..
Maybe:
dpkg -r eve4pve-autosnap_0.1.8_all.deb
dpkg -i cv4pve-autosnap_?.?.?-?_all.deb
hav i to delete the old cron file ? ( /etc/pve/eve/autosnap/eve4pve-autosnap.cron )
Many Thanks
I would like to thank the developer(s) for the efforts and the availability of a stable tool for autosnap as an addition to the proxmox VE for a long time. I appreciate the new efforts.
Apparently the new version of the tool provides static binaries only and heavily relies on Dotnet. I am aware there are open source claims of the .NET Foundation and the Technical Steering Group involved. I do not want to question there may be good cause and some business reasons to join such efforts.
Nevertheless, I would appreciate if you could provide deb-packages in continuity.
Hi,
It's not really a ticket but I just wanted to say thank you for this useful script! Very handy!
Keep up the good work please!
We had a crash of a whole host in our cluster (proxmox 6.2), in the following scenario:
We have not yet reconstructed the scenario - it is only a guess... but the impact was really deep...
Hi there,
Thank for awesome tool, but in proxmox when a disk got full, all QMEMU/LXC instance will get Pause due to I/O error so to avoid when snapshot cause disk getting full, can we have a feature like skip snapshot when disk is over 95% capacity?
My automatic snapshot are broken. I updated Proxmox from 5.4 to 6.1. with these results :
root@nfs1:~# ./cv4pve-autosnap --version
Automatic snapshot VM/CT with retention (Made in Italy)
1.7.2
root@nfs1:~# ./cv4pve-autosnap --host=hostname --username=snapshot-user@pve --password=PASSWORD --debug --vmid=102 status
Method: POST, Url: https://hostname:8006/api2/json/access/ticket
Parameters:
password : PASSWORD
username : snapshot-user
realm : pve
StatusCode: ServiceUnavailable
ReasonPhrase: Service Unavailable
IsSuccessStatusCode: False
Problem connection!
Package versions
proxmox-ve: 6.1-2 (running kernel: 5.3.13-3-pve)
pve-manager: 6.1-7 (running version: 6.1-7/13e58d5e)
pve-kernel-5.3: 6.1-3
pve-kernel-helper: 6.1-3
pve-kernel-5.3.13-3-pve: 5.3.13-3
pve-kernel-4.15.18-24-pve: 4.15.18-52
ceph: 14.2.6-pve1
ceph-fuse: 14.2.6-pve1
corosync: 3.0.3-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: 0.8.35+pve1
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.14-pve1
libpve-access-control: 6.0-6
libpve-apiclient-perl: 3.0-2
libpve-common-perl: 6.0-11
libpve-guest-common-perl: 3.0-3
libpve-http-server-perl: 3.0-4
libpve-storage-perl: 6.1-4
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 3.2.1-1
lxcfs: 3.0.3-pve60
novnc-pve: 1.1.0-1
openvswitch-switch: 2.10.0+2018.08.28+git.8ca7c82b7d+ds1-12+deb10u1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.1-3
pve-cluster: 6.1-4
pve-container: 3.0-19
pve-docs: 6.1-4
pve-edk2-firmware: 2.20191127-1
pve-firewall: 4.0-10
pve-firmware: 3.0-4
pve-ha-manager: 3.0-8
pve-i18n: 2.0-4
pve-qemu-kvm: 4.1.1-2
pve-xtermjs: 4.3.0-1
qemu-server: 6.1-5
smartmontools: 7.1-pve2
spiceterm: 3.1-1
vncterm: 1.6-1
zfsutils-linux: 0.8.3-pve1
My old installation with cv4pve-autosnap.1.2.0.debian-x64.deb does not work also.
root@nfs1:~# cv4pve-autosnap --host=hostname --username=snapshot-user@pve --password=PASSWORD --debug --vmid=102 status
Method: POST, Url: https://hostname:8006/api2/json/access/ticket
Parameters:
password : PASSWORD
username : snapshot-user
realm : pve
StatusCode: ServiceUnavailable
ReasonPhrase: Service Unavailable
IsSuccessStatusCode: False
================ EXCEPTION ================
Newtonsoft.Json.JsonReaderException
Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Corsinvest.ProxmoxVE.Api.ClientBase.ExecuteAction(String resource, HttpMethod method, IDictionary`2 parameters)
at Corsinvest.ProxmoxVE.Api.ClientBase.Login(String userName, String password, String realm)
at Corsinvest.ProxmoxVE.Api.ClientBase.Login(String userName, String password)
at Corsinvest.ProxmoxVE.Api.Extension.Utils.Shell.CommandOptionExtension.ClientTryLogin(CommandLineApplication command)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.CreateApp(CommandLineApplication parent) in C:\Users\Daniele\source\repos\OpenSource\ProxmoxVE\cv4pve-autosnap\src\dotnet\Corsinvest.ProxmoxVE.AutoSnap\ShellCommands.cs:line 32
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass4_1.b__1() in C:\Users\Daniele\source\repos\OpenSource\ProxmoxVE\cv4pve-autosnap\src\dotnet\Corsinvest.ProxmoxVE.AutoSnap\ShellCommands.cs:line 69
at McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.<>c__DisplayClass9_0.b__0()
at Corsinvest.ProxmoxVE.Api.Extension.Utils.Shell.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, TextWriter stdOut, String[] args)
What is wrong?
It would be good to process all VMs from a specified pool.
For example something like this:
cv4pve-autosnap --vmid="@Poolname"
Hi there,
I'm using your utility, running in crontab this command everynight:
cv4pve-autosnap --host=localhost --username=xxxxxxx --password=yyyyyyyy --timeout=8600 --vmid="all" snap --label='daily' --keep=7
Works everything since a lot of months except that, sometimes, on large disks VMs (for example VM with 2 Tb hdu), when it should purge old snapshots, it goes in error and vm status remain locked with "snapshot-delete" status. In also, old snapshot remains in "delete" status, it doesn't get deleted e I have to remove it manually with force switch.
In this state, VM is still running, but we cannot obviously do next snapshots in the next night, or even a vm backup.
So we must monitor every morning VM status and correct manually when this happens.
To fix this problem I use these commands:
qm unlock
qm delsnapshots "snapshots-name" -f
Our Proxmox filesystem is the old, but still reliable, directory filesystem over phisical hard disks, using qcow2 as vm file format.
Hello,
i use this crontab command to create a snapshot every 8 hours :
0 /8 * * * cv4pve-autosnap --host=localhost --username=user@pve --password=** --vmid="all" snap --label='8hours' --keep=5
but each snapshot shutdown the vm for 10 seconds, It doesn't matter 10 seconds, but I would like to know if it is possible to have a moment? or if there will always be a latency anyway?
Thanks
===== In execution release:
Version: 1.8.1
===== Last release:
Version: 1.9.5
Published At: 09/28/2020 09:16:59 +00:00
Download Url: https://github.com/Corsinvest/cv4pve-autosnap/releases/download/v1.9.5/cv4pve-autosnap-linux-x64.zip
Release Notes:
New version available: 1.9.5
Hello Daniele,
i have a strange result putting your great script inside a check script:
This is my routine:
cv4pve-autosnap --host=127.0.0.1 --username=cv4pve@pve --password=xxx--vmid="all" snap --label='daily' --keep=15
When i put it on my crontab, i hav always the error exit code but the script was executed ..
Thanks!
issue with version 1.2.0 So when a zfs sync is taking longer than the snapshot interval then zfs blocks deletion of snapshots.
cv4pve autosnapshot then leaves the all containers in locked mode preventing taking new snapshots.
We want to keep taking new snapshots so the code needs to detect fail due to dataset busy and unlock the vm after posting delete fail task.
validation fails for containers with fractional CPU limits (eg 0.5). since these values are valid, please correct argument validation.
How would one use this on crontab-ui? I've downloaded cv4pve-autosnap to the docker container, but it's unable to execute it since it's running with busybox. In order from cron to work it seem it would need to execute cv4pve-autosnap locally somehow.
Any tips how to set this up would be great.
Hello,
First of all, thank you for amazing tool!
Is it possible to exclude certain VMs from 'all'?
Thanks,
ignaqui
Hello,
How to install cv4pve-autosnap after unziping on Proxmox cli? Thanks.
Hello,
I tried installing this on my Proxmox host (v. 6.0-5) and receive the following dependency errors that I cannot figure out how to resolve.
None of the missing dependencies have any installation candidates.
root@prox1-R610:~# dpkg -i cv4pve-autosnap.1.1.1.debian-x64.deb
Selecting previously unselected package cv4pve-autosnap.
(Reading database ... 54863 files and directories currently installed.)
Preparing to unpack cv4pve-autosnap.1.1.1.debian-x64.deb ...
Unpacking cv4pve-autosnap (1.1.1) ...
dpkg: dependency problems prevent configuration of cv4pve-autosnap:
cv4pve-autosnap depends on liblttng-ust0; however:
Package liblttng-ust0 is not installed.
cv4pve-autosnap depends on libssl0.9.8 | libssl1.0.0 | libssl1.0.1 | libssl1.0.2; however:
Package libssl0.9.8 is not installed.
Package libssl1.0.0 is not installed.
Package libssl1.0.1 is not installed.
Package libssl1.0.2 is not installed.
dpkg: error processing package cv4pve-autosnap (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
cv4pve-autosnap
Any suggestions?
On a side note, should this be installed on the Proxmox host or another local server?
Thanks,
Mike
Today it aborted with this error:
# /usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=snapshot@pve --password='MYPass' --vmid=all snap --label='daily' --keep=14 --state
ACTION Snap
VMs: all
Label: daily
Keep: 14
State: True
----- VM 104 -----
Create snapshot: autodaily200820013035
VM execution 00:04:01.3424864
----- VM 105 -----
Create snapshot: autodaily200820013436
================ EXCEPTION ================
System.AggregateException
One or more errors occurred. (An error occurred while sending the request.)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Corsinvest.ProxmoxVE.Api.PveClientBase.ExecuteAction(String resource, MethodType methodType, IDictionary`2 parameters)
at Corsinvest.ProxmoxVE.Api.PveClientBase.TaskIsRunning(String node, String task)
at Corsinvest.ProxmoxVE.Api.PveClientBase.WaitForTaskToFinish(String node, String task, Int64 wait, Int64 timeOut)
at CallSite.Target(Closure , CallSite , PveClient , String , Object , Int32 , Int64 )
at Corsinvest.ProxmoxVE.Api.Extension.ResultExtension.WaitForTaskToFinish(Result result, VMInfo vm, Int64 timeout)
at Corsinvest.ProxmoxVE.Api.Extension.VM.Snapshots.Create(String name, String description, Boolean state, Int64 timeout)
at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
# /usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --username=snapshot@pve --password='MYPass' --vmid=all snap --label='daily' --keep=14 --state
ACTION Snap
VMs: all
Label: daily
Keep: 14
State: True
----- VM 104 -----
Create snapshot: autodaily200820014343
VM execution 00:01:36.5933939
----- VM 105 -----
Create snapshot: autodaily200820014520
VM execution 00:01:41.4674355
----- VM 106 -----
Create snapshot: autodaily200820014701
VM execution 00:01:15.2446069
----- VM 107 -----
Create snapshot: autodaily200820014816
================ EXCEPTION ================
System.AggregateException
One or more errors occurred. (An error occurred while sending the request.)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Corsinvest.ProxmoxVE.Api.PveClientBase.ExecuteAction(String resource, MethodType methodType, IDictionary`2 parameters)
at Corsinvest.ProxmoxVE.Api.PveClientBase.TaskIsRunning(String node, String task)
at Corsinvest.ProxmoxVE.Api.PveClientBase.WaitForTaskToFinish(String node, String task, Int64 wait, Int64 timeOut)
at CallSite.Target(Closure , CallSite , PveClient , String , Object , Int32 , Int64 )
at Corsinvest.ProxmoxVE.Api.Extension.ResultExtension.WaitForTaskToFinish(Result result, VMInfo vm, Int64 timeout)
at Corsinvest.ProxmoxVE.Api.Extension.VM.Snapshots.Create(String name, String description, Boolean state, Int64 timeout)
at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
What could be the problem?
I run it from latest ProxmoxVE.
Hi, the latest release, always show the warning of QEMU Agent not enabled, on both windows and linux VM:
VM XXX consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent
VM500 - W10 Pro, Latest QEMU-GA
VM800 - Debian 10 apt'd get qemu-ga
VM900 - Ubuntu lxc container
ACTION Snap
VMs: all
Label: Daily
Keep: 7
State: False
----- VM 500 -----
VM 500 consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent
Create snapshot: autoDaily190904155355
----- VM 800 -----
VM 800 consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent
Create snapshot: autoDaily190904155408
----- VM 900 -----
Create snapshot: autoDaily190904155409
EDIT:
After some digging, i've found that the error show up only if the option "Run guest-trim after clone disk" it's enabled
Hi all. I have use this perfect script. It looks like a very good solution but there is a small problem...
When VM status is locked there is no any kind of altert about it.
For example,
Tru lock a VM like this:
qm set 20009 --lock backup
Run a command like this:
root@osboxes:~# cv4pve-autosnap --host myhost --username root@pam --password=xxx --vmid 20009 snap --label='bar' --keep=2
ACTION Snap
VMs: 20009
Label: bar
Keep: 2
State: False
----- VM 20009 -----
VM 20009 consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent
Create snapshot: autobar191008075027
root@osboxes:~# echo $?
0
In cluster log we have an error because vm is locked. There is no create a snap for that vm but script runs without an error...
Please fix that because proxmox can lock vm e.g. during backup, and unlock in again in some cases...
Best regard, Viktor. Thank alot for you job!
Hello,
first of all, tanks to all contributes for this project.
Now my problem: Is there any way to change the naming of the snapshots? Currently they are named after autodaily%y%m%d%H%M. However, I would like to change it to auto-daily-%Y-%m%d-%H%M e.g.
================ EXCEPTION ================
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
'System.Dynamic.ExpandoObject' does not contain a definition for 'data'
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at CallSite.Target(Closure , CallSite , Object )
at Corsinvest.ProxmoxVE.Api.PveClientBase.TaskIsRunning(String node, String task)
at Corsinvest.ProxmoxVE.Api.PveClientBase.WaitForTaskToFinish(String node, String task, Int64 wait, Int64 timeOut)
at CallSite.Target(Closure , CallSite , PveClient , String , Object , Int32 , Int64 )
at Corsinvest.ProxmoxVE.Api.Extension.ResultExtension.WaitForTaskToFinish(Result result, VMInfo vm, Boolean wait)
at Corsinvest.ProxmoxVE.Api.Extension.VM.Snapshots.Remove(Snapshot snapshot, Boolean wait)
at Corsinvest.ProxmoxVE.AutoSnap.Commands.SnapshotsRemove(VMInfo vm, String label, Int32 keep)
at Corsinvest.ProxmoxVE.AutoSnap.Commands.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass6_1.b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Corsinvest.ProxmoxVE.Api.Extension.Helpers.Shell.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, TextWriter stdOut, String[] args)
Hello. Cannot create snapshot. What i do wrong?
root@proxmox:~# /usr/local/bin/cv4pve-autosnap --host=127.0.0.1 --api-token='cv4pve@pve!cv4pve' --timestamp-format=yyMMddss --vmid='1005' snap --label='-daily-' --keep=3
Problem connection! no tokenid specified
Create new environment with CV4PVE_AUTOSNAP_VMNAME
cv4pve-autosnap was working flawlessly until 2FA was enabled. It's running from a local machine inside the same network.
Here is the command and the result:
================ EXCEPTION ================
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
'System.Dynamic.ExpandoObject' does not contain a definition for 'data'
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.GetVMs(PveClient client)
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.GetVMs(PveClient client, String jolly)
at Corsinvest.ProxmoxVE.AutoSnap.Commands.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass6_1.b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Corsinvest.ProxmoxVE.Api.Extension.Helpers.Shell.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, TextWriter stdOut, String[] args)
Hi! Nice to see a new version. Thank you! Because you don't have a deb verison of v1.3.0 I have download binary like this:
wget https://github.com/Corsinvest/cv4pve-autosnap/releases/download/v1.3.0/cv4pve-autosnap-linux-x64.zip
root@osboxes:/tmp# cv4pve-autosnap -?
______ _ __
/ ____/___ __________(_)___ _ _____ _____/ /_
/ / / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / / (__ ) / / / / |/ / __(__ ) /_
\____/\____/_/ /____/_/_/ /_/|___/\___/____/\__/
Automatic snapshot VM/CT with retention (Made in Italy)
Automatic snapshot VM/CT with retention
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.
--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.
Report bugs to [email protected]
I think there is need a key for show verison of program. It can be -V or --version
Best regards, Viktor.
thanks a lot for cv4pve-autosnap!
Is there a way to turn saving RAM on or off?
Since this can be selected in the Web-Gui while saving Live-Snapshots.
Hi i have try to install cv4pve-autosnap.1.2.0.linux-x64.rpm, but rpm exit with error:
rpm -Uvh cv4pve-autosnap.1.2.0.linux-x64.rpm
warning: cv4pve-autosnap.1.2.0.linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID 811c1468: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:cv4pve-autosnap-1.2.0-0 ################################# [100%]
error: unpacking of archive failed on file /usr/sbin/cv4pve-autosnap;5d7a460c: cpio: Unknown file type
The tool worked for me for a few days and then stopped working.
I am using proxmox 6.3.3 from no-subscription channel.
In my cluster some nodes are shut down. This is the only obvious thing that might be different for my cluster compared to others.
/opt/cv4pve-autosnap --api-token 'root@pam!XXXXX' --host XXXX --vmid=200,201,202,204 snap --label='4hours' --keep=12 --debug
Method: GET, Url: https://XXXX:8006/api2/json/version
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": {
"version": "6.3-3",
"keyboard": "de",
"migration": {
"type": "secure",
"network": "192.168.88.1/24"
},
"release": "6.3",
"repoid": "eee5f901"
}
}
=============================
ACTION Snap
VMs: 200,201,202,204
Label: 4hours
Keep: 12
State: False
Timeout: 30000
Method: GET, Url: https://XXXX:8006/api2/json/cluster/resources?type=vm
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": [
{
"template": 0,
"node": "pve3",
"id": "qemu/118",
"uptime": 2386396,
"cpu": 0.0712415503131878,
"name": "GITLAB",
"netout": 156804366320,
"maxcpu": 4,
"netin": 12525075186,
"disk": 0,
"diskwrite": 372354505728,
"maxdisk": 107374182400,
"type": "qemu",
"mem": 4637929472,
"status": "running",
"vmid": 118,
"diskread": 351669629952,
"maxmem": 12582912000
},
[........ all my VMs .........]
]
}
=============================
================ EXCEPTION ================
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
'System.Dynamic.ExpandoObject' does not contain a definition for 'name'
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Corsinvest.ProxmoxVE.Api.Extension.VM.VMInfo.get_Name()
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.VmCheckIdOrName(VMInfo vm, String idOrNameCheck)
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.<>c__DisplayClass3_0.<GetVMs>b__1(VMInfo a)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.GetVMs(PveClient client, String jolly)
at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.GetVMs(String vmIdsOrNames)
at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
================ EXCEPTION ================
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
'System.Dynamic.ExpandoObject' does not contain a definition for 'name'
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Corsinvest.ProxmoxVE.Api.Extension.VM.VMInfo.get_Name()
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.VmCheckIdOrName(VMInfo vm, String idOrNameCheck)
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.<>c__DisplayClass3_0.<GetVMs>b__1(VMInfo a)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Corsinvest.ProxmoxVE.Api.Extension.VM.ClientExtension.GetVMs(PveClient client, String jolly)
at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.GetVMs(String vmIdsOrNames)
at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout)
at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
I have setup an SMB fileserver in an LXC container. My problem is that i cannot use these timestamps in the samba vfs shadow_copy2 module, because that need a 4-digit year string with some "_" separators to be compatible.
An example of this is the following: autohourly_20201213_193822
|
| -> name,"" separator, 4-digit year, 2-digit month, 2-digit day, "" separator, 2-digit hour,
2-digit minute, 2-digit second.
If you create a backup of all images in a pool, you get errors in proxmox syslog if you have images that are not snapable.
eg: if there is a template image you get errors like:
"TASK ERROR: you can't take a snapshot if it's a template"
if a vm have a disk that is not snapable you get:
TASK ERROR: snapshot feature is not available
the cron job generating these errors looks like:
0 * * * * root eve4pve-autosnap snap --vmid=all --label='hourly' --keep=6 --script='/usr/share/doc/eve4pve-autosnap/examples/script-hook.sh' --syslog
autosnap should not try to snapshot templates, and non snapable images
kind regards
Ronny Aasen
Hello, in my 3 nodes cluster,
after master node fails and vps migration on the slave, no more snapshot are generated (on the new master ).
First I tried cv4pve-tools, then toolbox because after spending HOURS in the cli setting up proxmox and migrating a bunch of VM's I just really wanted something NOT in the cli...
However, this feedback is for all of it.
It goes from the install to configuring backups, nothing about the actual setting up of the tool, how to get your license key, the "IMSI IP" and the "IP" token formatting(an example of how your application wants it implemented would be nice), none of it.
I went to the resources tab on your website and there is nothing, just a broken link, I went to the documentation tab, and it just shows you how to install it.
I have tried to get all that working 4 times now, I just keep wiping the docker containers, when I put in the wrong information(i guess?), the application completely error's out and won't even let me restore backup to try again. I keep having to wipe and reinstall. After 4 times...I'm just done.
And yes I know there is a premium option for support, but spending that time just fiddling with it on a home lab to consider trying to sell it to my workplace is....I'd rather just use Veeam.
I know I am a bit frustrated right now, and I don't mean to sound standoffish, but I guess my feedback is the documentation needs a serious overhaul.
Hello,
I have installed autosnap in a licensed proxmox 4.4.
The command:
eve4pve-autosnap snap --vmid=all --label='daily' --keep=10
gives no output
The command:
eve4pve-autosnap snap --vmid=104 --label='daily' --keep=10
gives:
ERROR: VM 104 - Unknown tecnology
What can I do?
Thanks,
Mario
The README.md provides a section on Configuration and Use that is incorrect:
Download package eve4pve-autosnap_?.?.?-?_all.deb, on your Proxmox VE host and install:
wget https://github.com/EnterpriseVE/eve4pve-autosnap/releases/latest dpkg -i eve4pve-autosnap_?.?.?-?_all.deb
(The latest
file contains a pointer to the downloadable deb
, not the archive itself.) Here are instructions that work for me:
wget https://github.com/$(wget -qO- https://github.com/EnterpriseVE/eve4pve-autosnap/releases/latest | grep -Po '(?<="/).*\.deb(?=")')
dpkg -i eve4pve-autosnap_?.?.?-?_all.deb
I'm using proxmox 6.2
I'm running the script on the host itself (just for now, untill we have another server available to put the script on).
I'm running this command:
/usr/sbin/cv4pve-autosnap --host='localhost' --api-token='MY TOKEN' --vmid='101' snap --label='daily' --keep=14 --debug
This is the output:
Method: GET, Url: https://localhost:8006/api2/json/version
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": {
"version": "6.2-11",
"keyboard": "fr-be",
"release": "6.2",
"repoid": "22fb4983"
}
}
=============================
ACTION Snap
VMs: 101
Label: daily
Keep: 14
State: False
Timeout: 30000
Method: GET, Url: https://localhost:8006/api2/json/cluster/resources?type=vm
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": []
}
=============================
Total execution 00:00:00.0246552
The connection is OK, but the snapshot was not created. I'm not sure why... the VM is online.
root@cv4pve:~# cv4pve-autosnap --host=10.10.90.50 --username=root@pam --password=[PW] --vmid=800 status
================ EXCEPTION ================
System.Exception
Problem connection!
at Corsinvest.ProxmoxVE.Api.Extension.Shell.Utils.CommandOptionExtension.ClientTryLogin(CommandLineApplication command)
at Corsinvest.ProxmoxVE.Api.Extension.App.AutoSnap.ShellCommand.CreateApp(CommandLineApplication autosnapCmd)
at Corsinvest.ProxmoxVE.Api.Extension.App.AutoSnap.ShellCommand.<>c__DisplayClass7_1.b__1()
at McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.<>c__DisplayClass9_0.b__0()
at Corsinvest.ProxmoxVE.Api.Extension.Shell.Utils.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, TextWriter std
Out, String[] args)
Please post an example in a doc how to use script argument with env like $CV4PVE_AUTOSNAP_VMID
I think a linux example will be very nice! Thank a lot!
Can you post an example here too, please? I don't know how to use that.
Best regard, Viktor.
Generated following the example:
cv4pve-autosnap --host=192.168.1.230 --username=root@pam --password=XXXXXX --vmid=500 snap --label='daily' --keep=2 at Windows machine.
The result is as follows:
ACTION Snap
VMs: 500
Label: 'daily'
Keep: 2
State: False
Timeout: 30000
Timestamp format: yyMMddHHmmss
----- VM 500 Qemu -----
Create snapshot: auto'daily'210919215747
snapname : invalid format - invalid configuration ID 'auto'daily'210919215747'
The removal of ' (inverted commas) solved the problem. I suggest to edit the sample script by removing the inverted commas.
The inverted commas are redundant. The commas are useful for the phrases containing spaces, yet it is unlikely that Proxmox would be ok with the snapshot names with spaces anyway. Even if it does, it is still not a good idea to put spaces into the snapshot name, so it should be discouraged.
I got the following error while testing autosnap on my LXC containers.
Traceback (most recent call last):
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 119, in <module>
remove_snapsot(vmid=k, virtualization=v, label=argp.label, keep=argp.keep, mute=argp.mute)
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 25, in create_pid
return func(*args, **kwargs)
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 68, in remove_snapsot
snapshots = run_command([virtualization, 'listsnapshot', vmid])
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 35, in run_command
return {'status': True, 'message': out.decode('utf-8').rstrip()}
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 45: invalid continuation byte
It's due to the fact that one of my containers has already a snap with accentuated characters in the comment.
Once the accentuated character removed, the process runs smoothly
OS: debian 9
PVE Version: pve-manager/5.4-10/9603c337
cv4pve version: 1.7.2
I changed backup method from eve4pve to cv4pve couple days ago.
using the same way , add a file in /etc/cron.d , with almost the same content , except the snapshot command.
but cv4pve wont take snapshot at the specified time in crontab.
I have no idea why .
I could run the command in prompt without problems , but it just won' start in crontab
here is /etc/cron.d/cv4pve-autosnap
2020-04-17 11:19:46 [root@hqs030 ~]$ cat /etc/cron.d/cv4pve-autosnap
MAILTO="[email protected]"
#ansible
0 2 * * * root cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 101 snap --keep 7 --label "_kw_ansible_"
#build
0 3 1 * * root cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 100 snap --keep 3 --label "_kw_build_"
2020-04-17 11:22:12 [root@hqs030 ~]$
in /var/log/cron.log , it shows the command already been executed.
Apr 16 23:00:01 hqs030 CRON[23813]: (root) CMD (tar czvf "/usr/local/backup/pve_\$(date '+%Y-%m-%d').tgz" /etc/pve)
Apr 17 02:00:01 hqs030 CRON[5722]: (root) CMD (cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 101 snap --keep 7 --label "_kw_ansible_")
but pve didnt see the sanpshot.
2020-04-17 11:24:56 [root@hqs030 cron.d]$ qm listsnapshot 101
`-> init_ansiblecontrol 2019-07-15 10:15:17 no-description
`-> before_upgrade_ansible_to_27 2019-07-19 11:29:56 no-description
`-> auto_kw_ansible_200415110438 2020-04-15 11:04:39 cv4pve-autosnap
`-> current You are here!
2020-04-17 11:25:37 [root@hqs030 cron.d]$
any suggestions ??
Is there a option to destroy snapshots only?
In case of replication then we should only destroy snapshots on the remote machine.
An option would be good.
I have a logical division of virtual machines into ranges, like windows 101-110, linux 201-220, etc. is it possible to make the pictures can be indicated by the range? Example
/usr/local/bin/pve-autosnap --host=127.0.0.1 --username=root@pam --password=MySecretPassword --vmid='111-119,202-205,302-304' snap --label='-daily-' --keep=1
Using eve4 to snap a Cloudlinux istance, the freeze option
cause filesystem lock.. it becomes read only.
We have tested it on 8 Server ( ZFS Filesystem )
The Web interface snap or replication snap are safe.
My question is, why do you use "freeze" ?
Is it possible to disable it and perform a standard zfs snapshot ?
Versione Italina:
Ciao Ragazzi, sempre molte grazie per il vostro tool veramente utilissimo.
Lo stiamo testando su 8 nodi Proxmox 5 (ZFS) ultima versione ma sulle istanze Cloudlinux ci causa un problema al kernel, che va in Read Only.
Gli snapshot fatti a riga di comando, via interfaccia web o quelli eseguiti dalle repliche sono OK.
Abbiamo notato che eve usa un opzione di freeze del Filesystem del VPS... e sembra questa la causa.
Forse è usato per renderlo compatibile con LVM ?.. sarebbe possibile poterlo disabilitare ?
Grazie!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.