cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2527
Views
12
Helpful
20
Replies

DNA Centre Backups

BlueyVIII
Level 1
Level 1

Has anyone found a simple way to automate the deletion of old DNAC Backups?

Our DNAC is set to backup to a Linux server each night, however, unless we remember to regularly go to the DNAC backup page and delete old backups the Linux server eventually runs out of disk space, and then the DNAC backups fail! As the DNAC Backup process doesn't send success/failure notifications the failures can go unnoticed for prolonged periods.

It would be fairly simple to create a LINUX CRON job to delete all the files older than (for example) 14 days, but I'm not sure if this would then cause a problem with the DNAC GUI which may not reflect they were deleted??

I'd be interested to see how others have solved the problem...

 

 

20 Replies 20

Torbjørn
Spotlight
Spotlight

You can clear old backups on your storage/backup server without issues. The deleted backups will automatically disappear from the DNAC UI without further intervention.

This tool (by Cisco employees) can be used to achieve what you are looking for: https://github.com/cskoglun/ciscodnacbackupctl 

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

Hi Everyone!

I have been told that if I click on the "Delete" button in DNAC at section "Backup and Restore". then the system does not delete the file from the server. Is it really true ?

I have observed my files actually being deleted on the backup server when deleting from the GUI. Maybe it depends on catalyst server version and the file server?

DJW487
Level 1
Level 1

I created a python script that deletes backups that are older than specified period of days.

Modify to suit your tastes. I am not a programmer by any stretch of the imagination, I just make things to work for me

I have 2 catalyst centre boxes now, so I do need to modify the URL to be a variable I can parse from CLI. I could also modify it to work from CRON on schedule, but I like to see what is happening with things sometimes so I just run this once a month right now.

 

I did create one that automates backups, since in the GUI you can only have one scheduled backup. I have a weekly full scheduled backup from the gui, then using API I have a nightly one that doesn't include assurance data.

Tomas de Leon
Cisco Employee
Cisco Employee

For Backup Retention & Automated deletion of older backups...

- In there current releases of the Catalyst Center OnPrem HW (P1.7), Backup Retention (in number of backups) is "not" available.

- In release 2.3.7.4 Catalyst Center on ESXi (P3.0), Backup Retention (in number of backups) is available. You can set the value from 3 to 60 backups and then the janitor cleanup is at 12am each day.

In a future release, both platforms will be a Platform 3.0 which will bring a lot of these features together. For your next question, which release? I will let the PMs answer that one as they have insights to the roadmap.

So the current method for deleting older or unwanted backups for the Catalyst Center OnPrem HW is to manually delete from the Admin UI one by one. Using scripts or removing on the remote file server has a potential for error. And this would not be optimal for your production data backups.

Hi, where is this set up? I have version 2.3.7.6 but do not see the function under System/Backup & Restore to automatically delete older system backups.

There are two versions of 2.3.7.6, the one for on-prem and the one for ESXi Virtual Appliance. The ESXi Virtual Appliance is the one that supports automatic backup retention. The on-prem (physical appliance) does not currently support it.

rasmus.elmholt
Level 7
Level 7

I have used this tool developed and maintained by some Cisco guys for a while: https://github.com/cskoglun/ciscodnacbackupctl

might be cool stuff, but we cannot use it on our hardened repos(

Hi,

the problem with that daemon is that it wont start by itself after a reboot. So I wrote a python3 script that will check the status and if necessary start the daemon:

import subprocess

def check_daemon_status():
    try:
        result = subprocess.run(['/home/myuser/.local/bin/ciscodnacbackupctl', 'daemon', 'status'], capture_output=True, text=True)
        output = result.stdout
        
        if "dead" in output:
            print("ciscodnacbackupctl daemon is dead. Restarting...")
            restart_result = subprocess.run(['/home/myuser/.local/bin/ciscodnacbackupctl', 'daemon', '--keep', '10', 'start'], capture_output=True, text=True)
            if restart_result.returncode == 0:
                print("ciscodnacbackupctl daemon restarted successfully.")
            else:
                print("Failed to restart ciscodnacbackupctl daemon:", restart_result.stderr)
        else:
            print("ciscodnacbackupctl daemon is running fine.")

    except Exception as e:
        print(f"Error occurred: {e}")

if __name__ == "__main__":
    check_daemon_status()

The script is started hourly by cron:

0 * * * * /usr/bin/python3 /home/myuser/ccc-backup-management/ccc-housekeeping-daemon-check.py

Please adjust the path(s) according to your setup.

Hth

Finally i made it w/o python with just a bash-script running from crone. it btw keeps script applied after repo reboots .

maflesch
Cisco Employee
Cisco Employee

As Tomas mentioned, the only supported method is through the UI of Catalyst Center. If you choose to use a script, regardless if it was developed by some Cisco guys or created internally with python, TAC does not support that. So, if you encounter a problem with your backups or when trying to restore due to those tools, you will not be able to get support on fixing this.

so is declared feature is available on the 2.3.7.6?

With Version 2.3.7.6-70319 via SSH? Nope!

Local hdd on ESXI? Yes

Review Cisco Networking for a $25 gift card