Bobcares

Last check time not updating in Nagios XI – How we troubleshoot it

by | Nov 15, 2020

‘Last check time not updating in Nagios XI’ arises due to many reasons that include connection issues to backend historical database, crashed database tables & so on.

Here at Bobcares, we have seen several such Nagios-related errors as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at how to fix this Nagios error.

 

Why is the last check time not updating in Nagios XI

Before we get into the solution part of this error, let’s first see what causes this problem to arise.

Often, this problem arises due to the connection issue to the backend historical database. Also, crashed database tables, core scheduling/check execution issues, or lack of resources cause this error to occur.

 

How we troubleshoot the problem ‘last check time not updating Nagios XI’

Now let’s see how our Support Engineers troubleshoot this problem in Nagios.

The troubleshooting step is mainly to verify if the checks are actually being scheduled and executed. If they are not then it is usually an issue with the Nagios Core engine. If they are then it is most likely a database issue.

However, the easiest way to verify this is to check the Nagios Core web frontend to see if the “Last Check” time is updating. For that, browse the below link:

http://<server_ip_or_hostname>/nagios/

If an object is currently experiencing issues with “Last Check” times then check any of the details. In case, the Core interface displays accurate “Last Check” times, proceed to Step 2 below. If the Core interface is experiencing the same issues as the XI interface then follow Step 1 below.

 

1. The check is failing to be scheduled or executed

Issues with the Nagios Core auto-rescheduler directives:

Initially, with the introduction of the auto_rescheduling feature in Nagios Core 4.0.8 there were a few bugs. Those affected by this bug will notice the nagios.log file filled with errors pertaining to rescheduled checks.

Originally, the new directives added to nagios.cfg could cause rescheduled checks to never execute, and instead be continuously rescheduled. The original /usr/local/nagios/etc/nagios.cfg directives were:

auto_reschedule_checks=1
auto_rescheduling_interval=30
auto_rescheduling_window=180

In order to resolve this issue, reduce the auto_rescheduling_window to 45.

auto_reschedule_checks=1
auto_rescheduling_interval=30
auto_rescheduling_window=45

After making the above changes are made to nagios.cfg, restart Nagios Core using one of the commands below:

RHEL 6|CentOS 6|Oracle Linux 6|Ubuntu 14

# service nagios restart

RHEL 7|CentOS 7|Oracle Linux 7|Debian|Ubuntu 16/18

# systemctl restart nagios.service

 

Resource Issues forcing the rescheduling of checks:

If the system ulimit settings are too restrictive, checks may be orphaned and forced to reschedule. Normally, this behavior is identified by checking the nagios.log file for lines similar to:

[1331905537] Warning: The check of service ‘SERVICE’ on host ‘NAMESERVER’ looks like it WAS orphaned (results never Came
back). I’m scheduling an immediate check of the service … [1331755699] Warning: The check of service ‘SWAP’ on host ‘nameserver’
not could be due to Performed to fork () error ‘Resource temporarily unavailable’. The check will be rescheduled.

In case, many of these lines exist in nagios.log, perform the following tasks to increase the kernel ulimts:

Edit the file /etc/security/limits.conf and define/update the following settings:

#locked memory
* hard memlock 128
* soft memlock 128

#open files
* soft nofile 10000
* hard nofile 10000
root hard nofile 10000
root soft nofile 10000

#max user processes
* hard nproc 4096
* soft nproc 4096

#stack size
* hard stack 20480
* soft stack 20480

If the setting does not exist then add the line. After making the changes save the file and restart the server.

Once the reboot completes, execute the following command to verify that the new settings are in place:

# ulimit -a

 

2. ndo2db is failing to insert the check result into the “Nagios” MySQL database.

Presence of crashed tables in the Nagios database:

Identification of crashed tables can be done by checking the MySQL/MariaDB logs located at:

/var/log/mysqld.log

or for MariaDB:

/var/log/mariadb/

The relevant errors should resemble:

141127 10:40:24 [ERROR] /usr/libexec/mysqld: Table ‘./nagios/nagios_logentries’ is marked as crashed and last (automatic?) repair failed

So, run the following commands to repair the tables.

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

After following all the above steps, ensure that multiple Nagios processes are not running. In order to check it run the below command.

# ps -ef | grep nagios.cfg | grep -v grep

The following output is healthy:

nagios 5713 1 0 08:40 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 5723 5713 0 08:40 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

In the above output, there is only one PID 5713 that is the parent process.

The second line has the PID 5723. However you can see that it references the parent PID of 5713, this is a child process of the parent and is normal behavior. On heavily-loaded systems, you may see multiple child processes – this is also normal behavior.

In case, if your output has more than one parent process, execute the following commands:

RHEL 6|CentOS 6|Oracle Linux 6|Ubuntu 14

# service nagios stop
# killall -9 nagios
# service nagios start

RHEL 7|CentOS 7|Oracle Linux 7|Debian|Ubuntu 16/18

# systemctl stop nagios.service
# killall -9 nagios
# systemctl start nagios.service

[Need any further assistance in fixing Nagios errors? – We are here to help you]

 

Conclusion

Today, we saw how our Support Engineers resolve this Nagios error and provide a solution to our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF