Page 1 of 2

MySQL Database backup warning

Posted: Mon Jan 16, 2017 2:50 pm
by absarcompass
Hi Guys,
I am receiving emails from NagiosXI Cron Daemon about MySql daily backup
It is about daily backup and rotation but at the end of email it says following
"----------------------------------------------------------------------
Backup End Tue Jan 17 07:00:46 NZDT 2017 ======================================================================
Total disk space used for backup storage..
Size - Location
1.7G /store/backups/mysql

======================================================================
If you find AutoMySQLBackup valuable please make a donation at
http://sourceforge.net/project/project_ ... _id=101066
======================================================================

###### WARNING ######
Errors reported during AutoMySQLBackup execution.. Backup failed Error log below..
-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.

"
can any one confirm what this warning is about and how it can be resolved?

Thanks

Re: MySQL Database backup warning

Posted: Mon Jan 16, 2017 3:04 pm
by dwhitfield
On about line 38 of /root/scripts/automysqlbackup change the following line

Code: Select all

    DBNAMES="all"
to

Code: Select all

    DBNAMES="nagios nagiosql nagiosxi"
Please let us know if that does not resolve your issue.

Re: MySQL Database backup warning

Posted: Tue Jan 17, 2017 2:28 pm
by absarcompass
Hi ,
I have done the above said changes and now the warning message is changed

###### WARNING ######
Errors reported during AutoMySQLBackup execution.. Backup failed Error log below..
mysqldump: Got error: 1049: Unknown database 'nagiosxi' when selecting the database


I know the database names should be default to what the NagiosXI team had set,
can any one suggest what might be wrong here?

Thanks

Re: MySQL Database backup warning

Posted: Tue Jan 17, 2017 2:48 pm
by dwhitfield
Log into mysql (or mariadb). What's the output of SHOW DATABASES;?

Re: MySQL Database backup warning

Posted: Wed Jan 18, 2017 3:28 pm
by absarcompass
This is the outpu
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nagios |
| nagiosql |
| test |
+--------------------+
5 rows in set (0.00 sec)


Thanks

Re: MySQL Database backup warning

Posted: Wed Jan 18, 2017 3:44 pm
by dwhitfield
Your nagiosxi database is likely in postgres. Assuming your Nagios XI is otherwise functioning properly, just change that line to the following:

Code: Select all

DBNAMES="nagios nagiosql"
If your XI is not otherwise functioning, please start a separate thread for that separate issue and we can work through that before continuing with the DB issue.

Re: MySQL Database backup warning

Posted: Wed Jan 18, 2017 3:48 pm
by absarcompass
I am a bit confused here,I am not sure if DB in nagiosxi is postgres of mysql.
I am currently having no issues with the functioning of NagiosXI operations but just that DB warning from cron daemon caught my attention.
so that warning error means that DB used in my NagiosXI is postgres and not mysql?

Re: MySQL Database backup warning

Posted: Wed Jan 18, 2017 4:15 pm
by dwhitfield
I apologize for the confusion. The short answer is the only way your XI could be working is if that database is in Postgres.

The longer version entails you posting the output of grep -R 'dbtype' '/usr/local/nagiosxi/html/config.inc.php' and cat /etc/cron.d/nagiosxi for the sake of a sanity check. Older versions of Nagios used postgres, but if you upgrade postgres gets carried along because that's way easier than migrating the data. You can find additional detail at https://support.nagios.com/forum/viewto ... 16&t=27884 .

Re: MySQL Database backup warning

Posted: Wed Jan 18, 2017 7:23 pm
by absarcompass
Here is the output

grep -R 'dbtype' '/usr/local/nagiosxi/html/config.inc.php'
$cfg['dbtype'] = ''; // this setting is no longer used - use settings below
"dbtype" => 'pgsql',
"dbtype" => 'mysql',
"dbtype" => 'mysql',
//if (!defined('CFG_ONLY')) { require_once(dirname(__FILE__).'/db/'.$cfg['dbtype'].'.inc.php'); }


cat /etc/cron.d/nagiosxi
# /etc/cron.d/nagiosxi: crontab fragment for nagiosxi

# Backup MySQL & PostgreSQL Databases
0 7 * * * root /root/scripts/automysqlbackup
0 7 * * * root /root/scripts/autopostgresqlbackup > /dev/null 2>&1

* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php > /usr/local/nagiosxi/var/sysstat.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php > /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php > /usr/local/nagiosxi/var/eventman.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php > /usr/local/nagiosxi/var/event_handler.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php > /usr/local/nagiosxi/var/feedproc.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php > /usr/local/nagiosxi/var/perfdataproc.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/nom.php > /usr/local/nagiosxi/var/nom.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/reportengine.php > /usr/local/nagiosxi/var/reportengine.log 2>&1
*/5 * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/dbmaint.php > /usr/local/nagiosxi/var/dbmaint.log 2>&1
* * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/cleaner.php > /usr/local/nagiosxi/var/cleaner.log 2>&1
01 * * * * nagios /usr/local/nagiosxi/cron/recurringdowntime.pl > /usr/local/nagiosxi/var/recurringdowntime.log 2>&1
*/5 * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/deadpool.php > /usr/local/nagiosxi/var/deadpool.log 2>&1


Current version of NagiosXI is 5.3.3. I have been upgrading XI from GUI and manually, neither had any issue with DB nor had been asked to migrate data from postgres to mysql.

Re: MySQL Database backup warning

Posted: Thu Jan 19, 2017 4:45 pm
by avandemore
Please run through the repair database document:

https://assets.nagios.com/downloads/nag ... tabase.pdf

If it fixes things, please monitor your email to see if the problem still persists. Let us know if it does.

You didn't mention what version you're on, but if you haven't upgraded to 5.4.0 you should consider doing so. After your DB is in good condition, you may also consider doing this:

https://support.nagios.com/kb/article.php?id=560