mirror of
https://github.com/uroni/urbackup-server-python-web-api-wrapper.git
synced 2025-10-26 11:38:16 +00:00
Add example listing backup counts
This commit is contained in:
parent
3f6cfb9fe8
commit
93a1ff67e6
42
test/list_backup_counts.py
Normal file
42
test/list_backup_counts.py
Normal file
@ -0,0 +1,42 @@
|
||||
import urbackup_api
|
||||
|
||||
server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
|
||||
|
||||
clients = server.get_status()
|
||||
|
||||
for client in clients:
|
||||
|
||||
file_backups = server.get_clientbackups(client["id"])
|
||||
|
||||
incr_file = 0
|
||||
full_file = 0
|
||||
|
||||
for file_backup in file_backups:
|
||||
|
||||
if file_backup["incremental"]>0:
|
||||
full_file+=1
|
||||
else:
|
||||
incr_file+=1
|
||||
|
||||
incr_image = 0
|
||||
full_image = 0
|
||||
|
||||
image_backups = server.get_clientimagebackups(client["id"])
|
||||
|
||||
for image_backup in image_backups:
|
||||
|
||||
if image_backup["letter"]=="SYSVOL" or image_backup["letter"]=="ESP":
|
||||
continue
|
||||
|
||||
if image_backup["incremental"]>0:
|
||||
full_image+=1
|
||||
else:
|
||||
incr_image+=1
|
||||
|
||||
print("Client {clientname} has {incr_file} incr file backups, {full_file} "
|
||||
"full file backups, {incr_image} incr image backups and "
|
||||
"{full_image} full image backups".format(
|
||||
incr_file=incr_file, clientname=client["name"],
|
||||
full_file=full_file, incr_image=incr_image,
|
||||
full_image=full_image) )
|
||||
|
||||
Loading…
Reference in New Issue
Block a user