repair database issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
JohnFLi
Posts: 517
Joined: Mon Jun 17, 2013 3:11 pm

repair database issue

Post by JohnFLi »

I ran:

Code: Select all

awk '/"nagiosxi" => array\(/{getline;print}' /usr/local/nagiosxi/html/config.inc.php
it returned: "dbtype" => 'mysql',
then i ran:

Code: Select all

/usr/local/nagiosxi/scripts/repair_databases.sh
all was good except for 1 item

Code: Select all

myisamchk: error: 'nagios_systemcommands' is not a MyISAM-table
i ran

Code: Select all

mysqlcheck -f -r -u root -pnagiosxi --all-databases
all was good except:

Code: Select all

nagios.nagios_statehistory                         OK
nagios.nagios_systemcommands
Error    : Incorrect file format 'nagios_systemcommands'
error    : Corrupt
nagios.nagios_timedeventqueue                      OK
nagios.nagios_timedevents                          OK
how do I fix this?
Everybody is somebody else’s weirdo
User avatar
JohnFLi
Posts: 517
Joined: Mon Jun 17, 2013 3:11 pm

Re: repair database issue

Post by JohnFLi »

I found teh fix for this...it was in Nagios documentation already

https://assets.nagios.com/downloads/nag ... tabase.pdf


on page 4 it says:

Code: Select all

If you receive an error, similar to this one:
Error : Incorrect file format 'nagios_systemcommands'
error : Corrupt
You will need to execute the following command to fix the table:
service mysqld start
echo 'repair table nagios_systemcommands use_frm;' | mysql -t -u root -pnagiosxi nagios
service mysqld restart
Then check the log file for errors
When I tried to start the service, i was told

Code: Select all

# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Failed to start mysqld.service: Unit not found.
ran the command anyway:

Code: Select all

echo 'repair table nagios_systemcommands use_frm;' | mysql -t -u root -pnagiosxi nagios
The result:

Code: Select all

 echo 'repair table nagios_systemcommands use_frm;' | mysql -t -u root -pnagiosxi nagios
+------------------------------+--------+----------+----------+
| Table                        | Op     | Msg_type | Msg_text |
+------------------------------+--------+----------+----------+
| nagios.nagios_systemcommands | repair | status   | OK       |
+------------------------------+--------+----------+----------+

tried the restart

Code: Select all

service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
Failed to restart mysqld.service: Unit not found.
so I ran the original repair anyway

Code: Select all

/usr/local/nagiosxi/scripts/repair_databases.sh
and now:

Code: Select all

===============
REPAIR COMPLETE
===============

=======================
nagios database repair succeeded
nagiosql database repair succeeded
nagiosxi database repair succeeded
Everybody is somebody else’s weirdo
gwesterman
Posts: 101
Joined: Wed Aug 23, 2023 11:29 am

Re: repair database issue

Post by gwesterman »

Glad you found the solution!

Let us know if you have any other questions.

Thank you!
Locked