Page 1 of 2
SQL error message after logging into new installation
Posted: Wed Feb 01, 2012 7:20 pm
by aakhtar
1. CentOS 6.0
2. 32-bit
3. VMware image from Nagios
4. No special configurations. Nothing has been done on the machine after installing Nagios.
After logging into Nagios XI, I receive an error message:
SQL: SQL Error [ndoutils] : Incorrect file format 'nagios_programstatus' SQL: SQL Error [ndoutils] : Incorrect file format 'nagios_programstatus'
I searched the Internet and found a PDF from Nagios that discussed running the following commands to repair the database. I ran them successfully but the error is still generated every time I log in:
service mysqld stop
/usr/local/nagiosxi/scripts/repairmysql.sh nagios *
service mysqld start
I searched the forum using keywords but didn't find any other post about this error message.
Do you know what the reason is and how I can resolve it? Thanks.
Re: SQL error message after logging into new installation
Posted: Fri Feb 03, 2012 11:51 am
by lmiltchev
If you saw something similar to this:
SQL: DELETE FROM nagios_logentries WHERE logentry_time < FROM_UNIXTIME(1293570334)
SQL: SQL Error [ndoutils] :</b> Table './nagios/nagios_logentries' is marked
as crashed and last (automatic?) repair failedCLEANING ndoutils TABLE 'notifications'...
then, you may need to run a force repair on the tables:
Code: Select all
service mysqld stop
cd /var/lib/mysql/nagios
myisamchk -r -f nagios_<corrupted_table>
service mysqld start
rm -f /usr/local/nagiosxi/var/dbmaint.lock
/usr/local/nagiosxi/cron/dbmaint.php
Hope this helps.
Re: SQL error message after logging into new installation
Posted: Mon Feb 06, 2012 11:52 am
by aakhtar
Thanks for the quick reply. I was hesitant to apply the suggestion because I didn't receive the kind of error you referenced. In any case, I tried to apply the suggestion but encountered the following error:
[root@mynagios ~]# service mysqld stop
Stopping mysqld: [ OK ]
[root@mynagios ~]# cd /var/lib/mysql/nagios
[root@mynagios nagios]# myisamchk -r -f nagios_programstatus
myisamchk: error: 'nagios_programstatus' is not a MyISAM-table
Am I not referencing the table correctly? From the error message that I mentioned, it appears the table's name is nagios_programstatus.
Re: SQL error message after logging into new installation
Posted: Tue Feb 07, 2012 11:56 am
by scottwilkerson
Run this command as root and report the output
Code: Select all
echo "USE nagios;show tables where Tables_in_nagios='nagios_programstatus';" |mysql -pnagiosxi
Re: SQL error message after logging into new installation
Posted: Tue Feb 07, 2012 4:27 pm
by aakhtar
Here is the result of the command:
[root@mynagios ~]# echo "USE nagios;show tables where Tables_in_nagios='nagios_programstatus';" | mysql -pnagiosxi
Tables_in_nagios
nagios_programstatus
Looks like there is a table named nagios_programstatus.
Re: SQL error message after logging into new installation
Posted: Tue Feb 07, 2012 6:03 pm
by scottwilkerson
Ok, that's positive...
Now
Code: Select all
echo "USE nagios;select instance_id, status_update_time,program_start_time,is_currently_running from nagios_programstatus" |mysql -pnagiosxi
Re: SQL error message after logging into new installation
Posted: Tue Feb 07, 2012 7:06 pm
by aakhtar
Here is the result of the command:
[root@mynagios ~]# echo "USE nagios;select instance_id,status_update_time,program_start_time,is_currently_running from nagios_programstatus" | mysql -pnagiosxi
ERROR 130 (HY000) at line 1: Incorrect file format 'nagios_programstatus'
Re: SQL error message after logging into new installation
Posted: Wed Feb 08, 2012 2:53 pm
by scottwilkerson
Please run
Code: Select all
mysqlcheck --auto-repair -A -pnagiosxi
Re: SQL error message after logging into new installation
Posted: Wed Feb 08, 2012 4:53 pm
by mguthrie
[root@mynagios nagios]# myisamchk -r -f nagios_programstatus
myisamchk: error: 'nagios_programstatus' is not a MyISAM-table
Just a note on this, it needs to be in on the <table_name>.MYI file. So for this circumstance it would need to be:
Code: Select all
myisamchk -r -f nagios_programstatus.MYI
Re: SQL error message after logging into new installation
Posted: Sat Feb 11, 2012 12:05 am
by aakhtar
@mguthrie
Adding the extension you mentioned did not work. Here is the result:
[root@mynagios nagios]# myisamchk -r -f nagios_programstatus.MYI
myisamchk: error: 'nagios_programstatus.MYI' is not a MyISAM-table