crash tables

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
gregwhite
Posts: 206
Joined: Wed Jun 01, 2011 12:40 pm

crash tables

Post by gregwhite »

Every few months our logentry table will crash. We run the following commands to fix it

service mysqld stop
cd /var/lib/mysql/nagios
myisamchk -r -f nagios_logentries.MYI
service mysqld start
rm -f /usr/local/nagiosxi/var/dbmaint.lock

Should we be running this on a regular basis (Preventative Maintenance) to avoid that table crashing in the first place?

Thanks,
Greg
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: crash tables

Post by dchurch »

Part of the reason that the nagios_logentries table crashes is because its storage engine is MyISAM. MyISAM does not support data integrity and transactional integrity. Indeed, it does not support any of the features needed for ACID. But it's fast.

If your time is really important to you, and you find yourself spending an inordinate amount of time recovering crashed tables, you could try converting them to InnoDB, which is robust and venerable, and is far less susceptible to "crashed" tables. But... there's a performance hit. If you're fine with that, then it should be okay for you to try it out.

Convert to InnoDB using this command:

Code: Select all

alter table nagios_logentries engine = InnoDB;
More on ACID and MySQL
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
gregwhite
Posts: 206
Joined: Wed Jun 01, 2011 12:40 pm

Re: crash tables

Post by gregwhite »

Thank your for you reply.
In lieu of converting to InnoDB, If we did a weekly or monthly repair, commands listed in the post, would that help avoid nagios_logentries table from crashing?

Thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: crash tables

Post by scottwilkerson »

There wouldn't be a benefit to preemptively running the repair. The most common reason a table becomes crashed (about 99.9% in my experience) is the table is locked open for writing and there is a power interruption (server loses power, or in a VM scenario, an unclean shutdown) OR there for some reason is an inability to write to disk.

In either of these scenarios, preemptively running a repair would not prevent the table from crashing if this occurs
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
gregwhite
Posts: 206
Joined: Wed Jun 01, 2011 12:40 pm

Re: crash tables

Post by gregwhite »

Thank you. Bear with me for one last question.
The nagios_logentries table seems to be the only table that crashes. Our instance of Nagios is polling 2250 devices and over 13,000 services and our database is hosted remotely on our Fusion server.
A lot of data is being written to the event log. If the number of events becomes excessive, could the event log become so busy that
the table crashes? Is this something to be concerned about? Would the performance hit for converting to lnnodb be worse than a crashed table?

I know, I said one question.
Thanks for your help.
Greg
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: crash tables

Post by scottwilkerson »

gregwhite wrote:Thank you. Bear with me for one last question.
The nagios_logentries table seems to be the only table that crashes. Our instance of Nagios is polling 2250 devices and over 13,000 services and our database is hosted remotely on our Fusion server.
A lot of data is being written to the event log. If the number of events becomes excessive, could the event log become so busy that
the table crashes? Is this something to be concerned about? Would the performance hit for converting to lnnodb be worse than a crashed table?

I know, I said one question.
Thanks for your help.
Greg
This is the table that crashes because this is the table that is being constantly written to.

With that many hosts and services I would actually not recommend changing the table type.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: crash tables

Post by SteveBeauchemin »

Do you have disk space problems?
The /tmp location may fill and cause problems in an innocent manner you may not notice.

I relocate my DB away from /var/lib which on my systems is tiny. I put it on a large dedicated volume.
I also relocate the temp data.

In my /etc/my.cnf file I use these settings. I have other settings too, but these pertain to possible space issues. I have a very large install so this matters to me and makes a big difference.

datadir=/usr/local/mysql
socket=/usr/local/mysql/mysql.sock
tmpdir=/usr/local/mysqltmp

You need to set the permission and owners properly.
Since doing this, in the last 4 years I may have had one DB issue. maybe...

I also use MySQLTuner-perl to get other suggestions to help make my DB operations run better.
My system has an offloaded database, 3374 host definitions, and 60,000 service tests running.

I hope this helps. You should have NO database problems.

Steve B
Hi Scott!
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: crash tables

Post by scottwilkerson »

SteveBeauchemin wrote:Do you have disk space problems?
The /tmp location may fill and cause problems in an innocent manner you may not notice.

I relocate my DB away from /var/lib which on my systems is tiny. I put it on a large dedicated volume.
I also relocate the temp data.

In my /etc/my.cnf file I use these settings. I have other settings too, but these pertain to possible space issues. I have a very large install so this matters to me and makes a big difference.

datadir=/usr/local/mysql
socket=/usr/local/mysql/mysql.sock
tmpdir=/usr/local/mysqltmp

You need to set the permission and owners properly.
Since doing this, in the last 4 years I may have had one DB issue. maybe...

I also use MySQLTuner-perl to get other suggestions to help make my DB operations run better.
My system has an offloaded database, 3374 host definitions, and 60,000 service tests running.

I hope this helps. You should have NO database problems.

Steve B
Hi Scott!
Thanks for the input @SteveBeauchemin!
Hope all is well
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
gregwhite
Posts: 206
Joined: Wed Jun 01, 2011 12:40 pm

Re: crash tables

Post by gregwhite »

Thanks to DChurch, Scott and Steve. Picked up some real good information and learned at lot more about tables and the cause of crashing. We will definitely look at Steve's recommendations. I would be interested in how Steve runs 60,000+ services. As I mentioned we are at 13,000 and wonder if we can push it more.

Thanks again,
Greg
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: crash tables

Post by scottwilkerson »

gregwhite wrote:Thanks to DChurch, Scott and Steve. Picked up some real good information and learned at lot more about tables and the cause of crashing. We will definitely look at Steve's recommendations. I would be interested in how Steve runs 60,000+ services. As I mentioned we are at 13,000 and wonder if we can push it more.

Thanks again,
Greg
Glad we could help!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked