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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Lisa.sorenson
Posts: 17
Joined: Wed Mar 05, 2014 11:37 am

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

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Lisa.sorenson
Posts: 17
Joined: Wed Mar 05, 2014 11:37 am

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

Post by Lisa.sorenson »

The output from that command is:
Table ' ./nagios/nagios_customvariablestatus' is marked as crashed and should be repaired
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Lisa.sorenson
Posts: 17
Joined: Wed Mar 05, 2014 11:37 am

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

Post by Lisa.sorenson »

Ran that command and am still getting same error when running update.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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.
Lisa.sorenson
Posts: 17
Joined: Wed Mar 05, 2014 11:37 am

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

Post 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?
Lisa.sorenson
Posts: 17
Joined: Wed Mar 05, 2014 11:37 am

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

Post 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!
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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.
Lisa.sorenson
Posts: 17
Joined: Wed Mar 05, 2014 11:37 am

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

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