Broken database

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
crafael01
Posts: 24
Joined: Mon Jul 15, 2013 11:28 am

Broken database

Post 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?
Last edited by crafael01 on Wed Aug 06, 2014 10:21 am, edited 1 time in total.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Broken database

Post by tmcdonald »

Run the following:

Code: Select all

/usr/local/nagiosxi/scripts/repair_databases.sh
Former Nagios employee
crafael01
Posts: 24
Joined: Mon Jul 15, 2013 11:28 am

Re: Broken database

Post by crafael01 »

Thank you! It's working now, but I actually had to run ./repairmysql.sh nagios.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Broken database

Post 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
Former Nagios employee
Locked