{"id":6320,"date":"2021-04-15T12:11:51","date_gmt":"2021-04-15T06:41:51","guid":{"rendered":"https:\/\/www.skynats.com\/?p=6320"},"modified":"2024-12-10T13:53:21","modified_gmt":"2024-12-10T08:23:21","slug":"fixing-event-data-getting-stale-in-nagios","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/fixing-event-data-getting-stale-in-nagios\/","title":{"rendered":"How to fix Event Data getting Stale in Nagios"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Some of our clients using Nagios have reported an issue with event data getting stale in Nagios in certain versions. This bug has since been patched and will be included in future releases. If you are still experiencing this error or notice that <a href=\"https:\/\/www.nagios.org\/\" target=\"_blank\" rel=\"noopener\">Nagios<\/a> services are taking longer than usual to start, it may be due to corruption in the MySQL table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our technical team support will fix event data getting stale in Nagios under our&nbsp;<a href=\"https:\/\/www.skynats.com\/linux-server-management\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"color:#016b99\" class=\"has-inline-color\">server management<\/span><\/a> plan. You can also take assistance from our technical team support 24\/7 will handle similar issues or any sort of installation and migration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fixing the event data getting Stale in Nagios.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To fix the issue there are two types of steps to be followed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Repair MySQL database:&nbsp;<\/strong>By running the command in the command line as root user, now you can repair the Nagios and Nagiosql databases.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/usr\/local\/nagiosxi\/scripts\/repairmysql.sh nagios\n# \/usr\/local\/nagiosxi\/scripts\/repairmysql.sh nagiosql\n# \/usr\/local\/nagiosxi\/scripts\/repairmysql.sh nagiosxi<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, you can also run the following command for Nagios XI 2014 and further versions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cd \/usr\/local\/nagiosxi\/scripts\/\n# .\/repair_databases.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This repair both databases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you still experience an error which has shown below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQL: DELETE FROM nagios_logentries WHERE logentry_time &lt; FROM_UNIXTIME(1293570334)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQL: SQL Error [ndoutils] :&lt;\/b&gt; Table &#8216;.\/nagios\/nagios_logentries&#8217; is marked as crashed and last (automatic?) repair failed CLEANING ndoutils TABLE &#8216;notifications&#8217;&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You need to run the force repair on the tables by using the following commands.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>RHEL 7|CentOS 7|Oracle Linux 7|Debian 9<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># systemctl stop mariadb.service\n# cd \/var\/lib\/mysql\/nagios\n# myisamchk -r -f nagios_&lt;corrupted_table&gt;\n# systemctl start mariadb.service\n# rm -f \/usr\/local\/nagiosxi\/var\/dbmaint.lock\n# php \/usr\/local\/nagiosxi\/cron\/dbmaint.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Debian 8|Ubuntu 16\/18<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># systemctl stop mysql.service\n# cd \/var\/lib\/mysql\/nagios\n# myisamchk -r -f nagios_&lt;corrupted_table&gt;\n# systemctl start mysql.service\n# rm -f \/usr\/local\/nagiosxi\/var\/dbmaint.lock\n# php \/usr\/local\/nagiosxi\/cron\/dbmaint.php\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Repair MySQL tables<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Stop following the services.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># service nagios stop\n# service ndo2db stop\n# service mysqld stop<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Later, run the following repair script for MySQL tables.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/usr\/local\/nagiosxi\/scripts\/repairmysql.sh nagios<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Later copy and unzip the dbmaint file to<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\/usr\/local\/nagiosxi\/cron\/. This will overwrite the previous version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cd \/tmp\n# wget \nhttp:&#47;&#47;assets.nagios.com\/downloads\/nagiosxi\/patches\/dbmaint.zip\n# unzip dbmaint.zip\n# chmod +x dbmaint.php\n# cp dbmaint.php \/usr\/local\/nagiosxi\/cron<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># service mysqld start\n# rm -f \/usr\/local\/nagiosxi\/var\/dbmaint.lock\n# \/usr\/local\/nagiosxi\/cron\/dbmaint.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start running the services after the script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># service ndo2db start\n# service Nagios start<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">However, if we see any error output from this script, similar to this one:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQL: DELETE FROM nagios_logentries WHERE logentry_time &lt; FROM_UNIXTIME(1293570334)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQL: SQL Error [ndoutils] :&lt;\/b&gt; Table &#8216;.\/nagios\/nagios_logentries&#8217; is marked as crashed and last (automatic?) repair failedCLEANING ndoutils TABLE &#8216;notifications&#8217;&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following force repair on the tables<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># service mysqld stop\n# cd \/var\/lib\/mysql\/nagios\n# myisamchk -r -f nagios_&lt;corrupted_table&gt;\n# service mysqld start\n# rm -f \/usr\/local\/nagiosxi\/var\/dbmaint.lock\n\/usr\/local\/nagiosxi\/cron\/dbmaint.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Conclusion<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In brief, you will get an apparent view of the cause for event data getting stale along with the stale in Nagios. You can also take our <a href=\"https:\/\/www.skynats.com\/contact-us\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"color:#046a96\" class=\"has-inline-color\">technical team support<\/span><\/a> for any assistance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some of our clients using Nagios have reported an issue with event data getting stale in Nagios in certain versions. This bug has since been patched and will be included in future releases. If you are still experiencing this error or notice that Nagios services are taking longer than usual to start, it may be [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,208,277,239,257,309,230,229,68,223,212],"tags":[317,316,508,263,46,310,233,22,236],"class_list":["post-6320","post","type-post","status-publish","format-standard","hentry","category-blog","category-centos-7","category-centos-8","category-linux","category-mysql","category-nagios","category-rhel-7","category-rhel8","category-server-management","category-ubuntu-18-04","category-ubuntu-20-04","tag-centos","tag-debian","tag-event-data-is-stale","tag-linux-server","tag-mysql-server","tag-nagios","tag-rhel-8-7","tag-server-support","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=6320"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6320\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=6320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=6320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=6320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}