Page 1 of 1

Nagios XI Backup Script failed

Posted: Fri Sep 20, 2024 2:00 pm
by jseldon
Hi guys,

When I logged in this morning I got an email that the Nagios XI backup had failed. I went looking into the logs and found the following:

Backing up MySQL databases...
mysqldump: unknown variable 'column-statistics=0'
Error backing up MySQL database 'nagios' - check the password in this script!

So I logged in manually to the host and tried to back up. Same issue. So I went into the script and found the following section:

Code: Select all

##############################
# BACKUP DATABASES
##############################
# Some versions of mysqldump don't have to column statistics option
if mysqldump --column-statistics=0 --version &>/dev/null; then
    column_option="--column-statistics=0"
else
    column_option=""
fi

Then I ran mysqldump locally to see what happen and got the following:

Code: Select all

mysqldump: unknown variable 'column-statistics=0'
mysqldump  Ver 10.19 Distrib 10.5.26-MariaDB, for debian-linux-gnu (x86_64)
The exit code is 0. So for some reason, this check passes and the column_option is still set despite not being supported.

For now I've manually removed this check and simply set column_option to "" and this works, but I'm wondering what changed and why this no longer works like it used to? Was this something changed in a recent update to the Nagios scripts? I'm not sure it's working as intended.

Thanks

James

Re: Nagios XI Backup Script failed

Posted: Mon Sep 23, 2024 9:55 am
by lgute
Hi @jseldon, thanks for reaching out.

I am going to create an issue, so we can get this resolved. What version of Debian are you running and what version of XI?

That code block was added in the 2024R1.0.2 maintenance release which was released 02/21/2024.

Re: Nagios XI Backup Script failed

Posted: Tue Sep 24, 2024 12:04 pm
by lgute
Hi @jseldon,

I am trying to duplicate the issue you are having with your XI backup script. I have tried Debian 10 & 11, without any luck.

Would you please execute both of these lines in a terminal and let me know the results?
  1. Current logic, with a bit of debugging.

    Code: Select all

    mysqldump --column-statistics=0 --version &>/dev/null; result=$?; if mysqldump --column-statistics=0 --version &>/dev/null; then column_option="--column-statistics=0"; else column_option=""; fi; echo "result [$result]"; echo "column_option [$column_option]";
    
  2. Alternate logic

    Code: Select all

    column_option=""; mysqldump --column-statistics=0 --version &>/dev/null; result=$?; if [ $result -eq 0 ]; then column_option="--column-statistics=0"; fi; echo "result code [$result]"; echo "column_option [$column_option]";
    

Re: Nagios XI Backup Script failed

Posted: Thu Sep 26, 2024 7:48 pm
by jseldon
I'm using Debian 11.

Both of these commands return a result of 0

Code: Select all

result code [0]
column_option [--column-statistics=0]
This aligns with what I see directly out of the bash result variable:

Code: Select all

$ mysqldump --column-statistics=0 --version
mysqldump: unknown variable 'column-statistics=0'
mysqldump  Ver 10.19 Distrib 10.5.26-MariaDB, for debian-linux-gnu (x86_64)jseldon@spwebnag001:/usr/local/nagiosxi/scripts$ mysqldump --column-statistics=0
$ echo $?
0

However - if I run the command without the version flag we get a non 0 result.

Code: Select all

$ mysqldump --column-statistics=0
mysqldump: unknown variable 'column-statistics=0'
$ echo $?
7

Re: Nagios XI Backup Script failed

Posted: Fri Sep 27, 2024 9:58 am
by lgute
Hi James (@jseldon),

Thank you for digging into that some more. I was wondering about the purpose of the --version flag. To be honest, I am surprised the logic works at all, with --version, because many times a flag like that will cause all other flags to be ignored.

I have updated the issue and notified development management.

Re: Nagios XI Backup Script failed

Posted: Fri Sep 27, 2024 12:21 pm
by jseldon
Thanks Laura. Appreciate the update.

Cheers

James
lgute wrote: Fri Sep 27, 2024 9:58 am Hi James (@jseldon),

Thank you for digging into that some more. I was wondering about the purpose of the --version flag. To be honest, I am surprised the logic works at all, with --version, because many times a flag like that will cause all other flags to be ignored.

I have updated the issue and notified development management.