Page 1 of 1

Nagios Xi not adhering to Local "Backup Limit"

Posted: Mon Nov 23, 2020 5:40 am
by paulconca
Hi All

I had to changed the local backup location as the default one is low on space. The new location is /var/log/backups/nagiosxi/backups/ and this works fine, the issue is that I set the "Backup Limit" to 2 but it does not delete them.
So everyday I have to go and delete the third one.

Is there a script i need to update to remedy this?


Thank you

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Mon Nov 23, 2020 6:31 pm
by benjaminsmith
Hi @paulconca,

What version of Nagios XI are you currently using and which Linux Distribution? I just tested this on 5.7.4 and it does automatically remove the older archives in that folder.

Regards,
Benjamin

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Tue Nov 24, 2020 5:00 am
by paulconca
Hi

Its Nagios XI 5.7.3 (We cannot upgrade at the moment)

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Thank you

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Tue Nov 24, 2020 6:20 pm
by benjaminsmith
Hi,

Let's query to the database directly to check if the limit setting has been written correctly. Please post the output to the following command.

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosxi -e "select * from xi_options where name like 'scheduled%backups';"
Also, please send me the system profile as well. Thanks, Benjamin

To send us your system profile
.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Wed Nov 25, 2020 5:33 am
by paulconca
I sent you the profile, via private message

here is the output for the local backup, the one which fails.

| 115 | scheduled_local_backups | a:9:{s:6:"active";i:1;s:4:"freq";s:5:"daily";s:3:"day";s:1:"0";s:5:"hours";s:2:"09";s:4:"mins";s:2:"30";s:3:"dir";s:34:"/var/log/backups/nagiosxi/backups/";s:5:"limit";s:1:"2";s:7:"lastrun";i:1606296602;s:7:"nextrun";i:1606383000;}

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Wed Nov 25, 2020 5:27 pm
by benjaminsmith
Hi @paulconca,

I think what is happening is that the permissions are not correct. I was able to repeat this condition. It can write to that custom folder but it is not able to remove the older archives.
?
What output do you get when you select the Test Permissions button from the Scheduled Backups page?
scheduled-backups-folder.png
The permissions on the backup directory should be as follows.

Code: Select all

drwxr-xr-x. 2 nagios nagios 6 Apr 17  2020 /store/backups/nagiosxi

Code: Select all

chown nagios:nagios /var/log/backups/nagiosxi/backups/ -R
chmod 775 /var/log/backups/nagiosxi/backups/ -R
Then run another scheduled backup and it should remove the older archives.

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Thu Nov 26, 2020 1:21 pm
by paulconca
Thanks

For the test I get "The directory exists and is writeable."


Rights for the backup folder
drwxr-xr-x 2 nagios nagios 4.0K Nov 26 17:30 backups


chown nagios:nagios /var/log/backups/nagiosxi/backups/ -R
chmod 775 /var/log/backups/nagiosxi/backups/ -R
Results after I run the above, the third back up, still remains and if you notice the rights are different on the one created by the backup -rw-r--r--

-rwxrwxr-x 1 nagios nagios 15G Nov 25 10:50 nagiosxi.1606296602.tar.gz
-rwxrwxr-x 1 nagios nagios 15G Nov 26 10:52 nagiosxi.1606383001.tar.gz
-rw-r--r-- 1 nagios nagios 15G Nov 26 17:30 nagiosxi.1606407002.tar.gz

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Tue Dec 01, 2020 2:44 pm
by ssax
What is the output of this command?

Code: Select all

grep nag /etc/group
Please edit this file:

Code: Select all

/usr/local/nagiosxi/html/includes/constants.inc.php
At the bottom, change this:

Code: Select all

define('SB_LOGLEVEL', 3);
To this:

Code: Select all

define('SB_LOGLEVEL', 0);
Then run this command as root (and leave it running):

Code: Select all

tail -F /var/log/httpd/error_log /var/log/httpd/ssl_error_log /usr/local/nagiosxi/var/cmdsubsys.log /usr/local/nagiosxi/var/components/scheduledbackups.log
Then force a scheduled backup to run and after it's completed or failed, send me the entire output from the tail command above and send me this file:

Code: Select all

/usr/local/nagiosxi/var/components/scheduledbackups.log

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Wed Dec 02, 2020 6:09 am
by paulconca
[root@oeismon01 concannp]# grep nag /etc/group
nagios:x:1001:nagios,apache,snmptt
nagcmd:x:1002:nagios,apache,snmptt



I sent you the rest via private message.

Thank you

Re: Nagios Xi not adhering to Local "Backup Limit"

Posted: Wed Dec 02, 2020 4:28 pm
by ssax
Please create a ticket for this and include a link back to this forum thread so we can get a remote session setup:

https://support.nagios.com/tickets/

Please include this info in that new ticket as well:
- NOTE: You may need to adjust the -h 127.0.0.1, the -uroot, and -pnagiosxi in the first command if your DB is offloaded to another server and/or you've changed the root mysql password

Code: Select all

echo "SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema IN ('nagios', 'nagiosql', 'nagiosxi');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table