Nagios xi Backup Script failed

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
jseldon
Posts: 4
Joined: Thu Jul 18, 2024 1:50 pm

Nagios xi Backup Script failed

Post 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
User avatar
lgute
Posts: 318
Joined: Mon Apr 06, 2020 2:49 pm

Re: Nagios xi Backup Script failed

Post 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.
Please let us know if you have any other questions or concerns.

-Laura
User avatar
lgute
Posts: 318
Joined: Mon Apr 06, 2020 2:49 pm

Re: Nagios xi Backup Script failed

Post 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]";
    
Please let us know if you have any other questions or concerns.

-Laura
jseldon
Posts: 4
Joined: Thu Jul 18, 2024 1:50 pm

Re: Nagios xi Backup Script failed

Post 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
User avatar
lgute
Posts: 318
Joined: Mon Apr 06, 2020 2:49 pm

Re: Nagios xi Backup Script failed

Post 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.
Please let us know if you have any other questions or concerns.

-Laura
jseldon
Posts: 4
Joined: Thu Jul 18, 2024 1:50 pm

Re: Nagios xi Backup Script failed

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