Page 1 of 2

NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Mon May 11, 2015 4:15 pm
by Lisa.sorenson
When running NagiosXI update from version 2.6 to 2.7 I am getting this message:
Backing up MySQL databases...
mysqldump: Got error: 145: Table './nagios/nagios_customvariablestatus' is marked as crashed and should be repaired when using LOCK TABLES
Error backing up MySQL database 'nagios' - check the password in this script!

How do I resolve this?

Thanks

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Mon May 11, 2015 4:54 pm
by lmiltchev
What is the output of the following command?

Code: Select all

tail -20 /var/log/mysqld.log
You may need to run the repair on the database:

Code: Select all

cd /usr/local/nagiosxi/scripts
./repair_databases.sh

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Mon May 11, 2015 5:51 pm
by Lisa.sorenson
The output from that command is:
Table ' ./nagios/nagios_customvariablestatus' is marked as crashed and should be repaired

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Mon May 11, 2015 8:46 pm
by Box293
Please run these commands:

Code: Select all

cd /usr/local/nagiosxi/scripts
./repair_databases.sh
Once these are completed please re-run the upgrade.

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Tue May 12, 2015 12:00 pm
by Lisa.sorenson
Ran that command and am still getting same error when running update.

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Tue May 12, 2015 1:09 pm
by jdalrymple

Code: Select all

[root@localhost ~]# service mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@localhost ~]# myisamchk -r -f /var/lib/mysql/nagios/nagios_customvariablestatus
- recovering (with sort) MyISAM-table '/var/lib/mysql/nagios/nagios_customvariablestatus'
Data records: 4
- Fixing index 1
- Fixing index 2
- Fixing index 3
[root@localhost ~]# service mysqld start
Starting mysqld:                                           [  OK  ]
Then try again.

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Tue May 12, 2015 1:24 pm
by Lisa.sorenson
The update still did not complete successfully:

Backing up MySQL databases...
mysqldump: Got error: 145: Table './nagios/nagios_logentries' is marked as crashed and should be repaired when using LOCK TABLES
Error backing up MySQL database 'nagios' - check the password in this script!

Do I run the same command for _logentries and try again?

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Tue May 12, 2015 1:29 pm
by Lisa.sorenson
Tried cleaning up the logentries and get this:

Backing up MySQL databases...
mysqldump: Got error: 144: Table './nagios/nagios_processevents' is marked as crashed and last (automatic?) repair failed when using LOCK TABLES
Error backing up MySQL database 'nagios' - check the password in this script!

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Tue May 12, 2015 1:38 pm
by jdalrymple
You really shouldn't have to do this...

Did this server suffer a hard shutdown, or is it maybe a restore from a VMware snapshot or something? This is not typical behavior.

Code: Select all

service mysqld stop
for file in `ls /var/lib/mysql/nagios/ | grep "MYI"`; do myisamchk -r -f /var/lib/mysql/nagios/$file; done
service mysqld start
Only perform the above if you have a backup you know is good of your database. This does a forceful repair on all tables and could potentially involve data loss.

Re: NagiosXI Update Failed - 2014r2.6 to 2014r2.7

Posted: Tue May 12, 2015 3:47 pm
by Lisa.sorenson
Thank you, that command appeared to work with no loss of data. I was able to update to 2.7 successfully.

Thanks!