Backup limit not honored for SSH backups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dflick
Posts: 72
Joined: Tue Nov 12, 2013 3:16 pm

Backup limit not honored for SSH backups

Post by dflick »

I SSH backups to a remote server daily from my Nagios server. I have the backup limit on the ssh page set to 7 but the server does not cleanup the old files causing the remote server disk to fill. The SSH user is able to send file and delete files on the remote server with no issues.
[caecd@localhost nagiosbackup]$ ls
ssh_test_secure_copy.txt
[caecd@localhost nagiosbackup]$ rm ssh_test_secure_copy.txt
[caecd@localhost nagiosbackup]$ ls
[caecd@localhost nagiosbackup]$

The backup logs seems to be OK:
03-03-2016 00:00:01 DEBUG: Running scheduled local backup ...
03-03-2016 00:00:01 INFO: Creating a local backup: nagiosxi.1456984801
03-03-2016 00:00:01 INFO: Too many backups! Limit is 7. Removing: nagiosxi.1428728401.tar.gz before proceeding with backup.
03-03-2016 00:00:03 DEBUG: Sending create local backup command to CmdSubsystem
03-03-2016 03:00:01 DEBUG: Running scheduled SSH backup ...
03-03-2016 03:00:01 DEBUG: Sending create local backup command to CmdSubsystem

The nagiosxi.1428728401.tar.gz file above was not removed from the remote server.

I am running 2.7 on CentOS6
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Backup limit not honored for SSH backups

Post by tmcdonald »

Are you on 2014R2.7 or 2012R2.7? This should have been fixed in 2014R2.1. Let us know your full version and we can test this out.
Former Nagios employee
dflick
Posts: 72
Joined: Tue Nov 12, 2013 3:16 pm

Re: Backup limit not honored for SSH backups

Post by dflick »

I am on 2014R2.7
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Backup limit not honored for SSH backups

Post by lmiltchev »

I tested this on Nagios XI 5.2.5 and "Scheduled Backups" component ver. 1.1.2. It worked as expected. I setup my "Backup Limit" to "2", and I have only two backups on the remote server.

Code: Select all

root@debian:/home/lmiltchev/backups# ls -la
total 300036
drwxrwxrwx 2 lmiltchev lmiltchev      4096 Mar  3 13:54 .
drwxr-xr-x 3 lmiltchev lmiltchev      4096 Mar 29  2015 ..
-rw-r--r-- 1 lmiltchev lmiltchev 153447159 Mar  3 13:47 nagiosxi.1457034422.tar.gz
-rw-r--r-- 1 lmiltchev lmiltchev 153463286 Mar  3 13:54 nagiosxi.1457034842.tar.gz
-rw-r--r-- 1 lmiltchev lmiltchev       110 Mar  3 13:03 ssh_test_secure_copy.txt
In my case, the backup limit was honored.

Remove all of the backups but let's say one or two. Watch the backup directory on the remote box to see if the backup number will exceed 7. If it does, try upgrading to the latest release of XI to see if this is going to fix the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Backup limit not honored for SSH backups

Post by rkennedy »

Also - does the remote SSH user have permission to delete files? One thing to check on top of what @lmiltchev mentioned.
Former Nagios Employee
dflick
Posts: 72
Joined: Tue Nov 12, 2013 3:16 pm

Re: Backup limit not honored for SSH backups

Post by dflick »

Upgrading is really not an option at the moment. Is there anything I can do to troubleshoot the existing install? @rkennedy see my original post on ssh permission. It is tested and working.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Backup limit not honored for SSH backups

Post by lmiltchev »

Do you have only the "SSH" scheduled backup set up in XI or you also have the "FTP" and/or "Local" backups set up? What are the "Backup Limit" values on all of them?

How many backups do you have on the remote server at the moment? Can you run the following commands on the remote box?

Code: Select all

ls -lad /path/to/the/backup/directory
ls -la /path/to/the/backup/directory
Be sure to check out our Knowledgebase for helpful articles and solutions!
dflick
Posts: 72
Joined: Tue Nov 12, 2013 3:16 pm

Re: Backup limit not honored for SSH backups

Post by dflick »

FTP Backups: Disabled
SSH Backups: Enabled - Next Run: Fri, Mar 4th at 3:00 AM -06:00 CST
Local Backups: Enabled - Next Run: Fri, Mar 4th at 12:00 AM -06:00 CST
Last Backup Size: 360.41 MB

[root@localhost nagiosbackup]# ls
ssh_test_secure_copy.txt
[root@localhost nagiosbackup]# ls -lad
drwxrwxr-x 2 bexar bexar 8192 Mar 3 06:47 .
[root@localhost nagiosbackup]# ls -la
total 16
drwxrwxr-x 2 bexar bexar 8192 Mar 3 06:47 .
drwx------ 3 bexar bexar 4096 Oct 18 2014 ..
-rw-r--r-- 1 bexar bexar 110 Mar 3 06:47 ssh_test_secure_copy.txt
[root@localhost nagiosbackup]#

There is only one file as there were about 50 zero byte files that I deleted. I have gone through this exercise several times already so I know it will not delete the backups.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Backup limit not honored for SSH backups

Post by lmiltchev »

What is the "Scheduled Backups" component version that you see under the "Manage Components" page?

Admin->Manage Components

Do you see a new version available for download when you click on "Check for Updates"?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked