Page 1 of 1

Broken database

Posted: Wed Aug 06, 2014 10:17 am
by crafael01
Hi,

I came into work this morning to find this error message:

SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and last (automatic?) repair failed SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and last (automatic?) repair failed

Any idea how to recover from this?

Re: Broken database

Posted: Wed Aug 06, 2014 10:20 am
by tmcdonald
Run the following:

Code: Select all

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

Re: Broken database

Posted: Wed Aug 06, 2014 10:26 am
by crafael01
Thank you! It's working now, but I actually had to run ./repairmysql.sh nagios.

Re: Broken database

Posted: Wed Aug 06, 2014 10:29 am
by tmcdonald
The command I posted runs that as part of the script:

Code: Select all

#!/bin/sh
PATH=$PATH:/sbin:/usr/sbin

BASEDIR=$(dirname $0)
if [ ! -f "$BASEDIR/repair_databases.lock" ];then
    touch "$BASEDIR/repair_databases.lock"
    /sbin/service mysqld status
    mysqlstatus=$?
    if [ ! $mysqlstatus -eq 0 ];then
            rm -f /var/lib/mysql/mysql.sock
            /sbin/service mysqld start
    fi
    $BASEDIR/repairmysql.sh nagios
    $BASEDIR/repairmysql.sh nagiosql
    /sbin/service ndo2db restart
    /sbin/service nagios restart
    rm -f "$BASEDIR/repair_databases.lock"
fi