Nagios Xi not adhering to Local "Backup Limit"

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Nagios Xi not adhering to Local "Backup Limit"

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

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

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

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

Post 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;}
You do not have the required permissions to view the files attached to this post.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

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

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

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

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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
Locked