Event Data getting Stale in Nagios - Resolve it Now ?









Are you trying to resolve Event Data getting Stale in Nagios?

This guide will help you.


Sometimes, our customers using Nagios reported a bug relating to event data in some Nagios versions. However, this bug has been patched and will be available in releases later. 

But if we are experiencing this error and/or the Nagios service is taking an excessively long time to start, we may have a corrupted MySQL table.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to handle Nagios related issues.


Methods to fix Event Data getting Stale on Nagios ?

Apply the tips given below to resolve this Nagios problem.


1. Repair MySQL database

We can repair the Nagios and nagiosql databases by executing the following commands in the command line as the root user:

# /usr/local/nagiosxi/scripts/repairmysql.sh nagios
# /usr/local/nagiosxi/scripts/repairmysql.sh nagiosql
# /usr/local/nagiosxi/scripts/repairmysql.sh nagiosxi

Alternatively, we can use the following command for Nagios XI 2014 and further versions:

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

This will actually repair both databases.


If we encounter an error, similar to the following:

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 failed CLEANING ndoutils TABLE 'notifications'...

We may need to run a force repair on the tables using the following commands:

On RHEL 7|CentOS 7|Oracle Linux 7|Debian 9,

# systemctl stop mariadb.service
# cd /var/lib/mysql/nagios
# myisamchk -r -f nagios_<corrupted_table>
# systemctl start mariadb.service
# rm -f /usr/local/nagiosxi/var/dbmaint.lock
# php /usr/local/nagiosxi/cron/dbmaint.php

On Debian 8|Ubuntu 16/18, 

# systemctl stop mysql.service
# cd /var/lib/mysql/nagios
# myisamchk -r -f nagios_<corrupted_table>
# systemctl start mysql.service
# rm -f /usr/local/nagiosxi/var/dbmaint.lock
# php /usr/local/nagiosxi/cron/dbmaint.php


2. Repair MySQL tables

Start by stopping the following services with the commands below:

# service nagios stop
# service ndo2db stop
# service mysqld stop

After that, we can run the following repair script for MySQL tables:

# /usr/local/nagiosxi/scripts/repairmysql.sh nagios

Then unzip and copy the following dbmaint file to /usr/local/nagiosxi/cron/. This will overwrite the previous version.

# cd /tmp
# wget http://assets.nagios.com/downloads/nagiosxi/patches/dbmaint.zip
# unzip dbmaint.zip
# chmod +x dbmaint.php
# cp dbmaint.php /usr/local/nagiosxi/cron

After that, we need to run the following commands:

# service mysqld start
# rm -f /usr/local/nagiosxi/var/dbmaint.lock
# /usr/local/nagiosxi/cron/dbmaint.php

After running this script, start these services:

# service ndo2db start
# service Nagios start

However, if we see any error output from this script, similar to this one:

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'...

We may need to run a force repair on the tables:

# 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


[Need urgent Assistance in Fixing Nagios errors? We are happy to help you! ]

Conclusion

This article covers methods to fix Event Data getting Stale in Nagios. Basically, you will see the causes for event data getting stale in Nagios. There is a known bug relating to event data in versions 2009R1.4B-2011R1.1.

This bug has been patched and will be available in releases later than the versions posted above, but if you're experiencing this error, and/or the nagios service is taking an excessively long time to start, you may have a corrupted mysql table that needs repair.


To fix this Nagios error:

1. Stop the following services:

$ service nagios stop
$ service ndo2db stop
$ service mysqld stop

2. Run the repair script for mysql tables:

/usr/local/nagiosxi/scripts/repairmysql.sh nagios

3. Unzip and copy the the following dbmaint file to /usr/local/nagiosxi/cron/. This will overwrite the previous version.

$ cd /tmp
$ wget http://assets.nagios.com/downloads/nagiosxi/patches/dbmaint.zip
$ unzip dbmaint.zip
$ chmod +x dbmaint.php
$ cp dbmaint.php /usr/local/nagiosxi/cron



Keep In Touch

We hope to hear from you.

Accept File Type: jpg,jpeg,png,txt,pdf,doc,docx