Page 1 of 2

Host is not scheduled to be checked...

Posted: Wed Mar 29, 2017 8:05 am
by neel5481
Hi,

I am using cent OS 7 with nagios 4.0.8.
I am always getting host status as "Pending" with status information saying "Host is not scheduled to be checked... ".

Below are my hosts.cfg and services.cfg file content.

hosts.cfg
define host {
host_name MyLocalHost
address 127.0.0.1
use generic-host
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
max_check_attempts 10
}

services.cfg
define service {
host_name MyLocalHost
service_description MyService
use generic-service
check_command check_ping!3000.0,80%!5000.0,100%
check_freshness 0
contact_groups admins
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
}

I have added this file entry in nagios.cfg file under "cfg_file" as below.

cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg

Can you please suggest how to make host "Up" ?

Thanks in Advance.

Re: Host is not scheduled to be checked...

Posted: Wed Mar 29, 2017 10:05 am
by tgriep
In your host.cfg and service.cfg file, you have the disabled the active checks which will stop the check from running.
Since it is disabled, the active check will never run, and that is causing the message you are seeing.

Edit both the service and host configuration files and change the following from

Code: Select all

active_checks_enabled 0
to

Code: Select all

active_checks_enabled 1
Also, in the hosts.cfg file, you do not have an active check defined, add the following check command to that host.cfg file.

Code: Select all

check_command                   check-host-alive
Save the files and restart the nagios daemon and that should schedule the active checks to start to run for both the host and service checks.

Take a look at this link for the details on active checks.
https://assets.nagios.com/downloads/nag ... hecks.html

Re: Host is not scheduled to be checked...

Posted: Wed Mar 29, 2017 1:16 pm
by neel5481
Thank you for your quick reply.

Host is up now with your suggestion. I have made same changes to services.cfg file but on main "Services" page status shows "Pending" but when we click on that service then it display correct current status. Any reason for this ?

My services.cfg file looks as below after your suggestion.

define service {
host_name MyLocalHost
service_description MyService
use generic-service
check_command check_ping!3000.0,80%!5000.0,100%
check_freshness 0
contact_groups admins
active_checks_enabled 1
passive_checks_enabled 1
flap_detection_enabled 0
}

Re: Host is not scheduled to be checked...

Posted: Wed Mar 29, 2017 2:01 pm
by tgriep
It could of taken a few minutes to update the Main services screen due to the refresh rate on the menu that could of caused the delay.
If you go back, does it still show pending?
Try clearing your browsers cache and see if that helps out as well.

Re: Host is not scheduled to be checked...

Posted: Wed Mar 29, 2017 11:56 pm
by neel5481
I have tried as per your suggestion regarding clear the cache and waited for half an hour but service status always shows "OK" on main services page.
I am suspecting something wring with 'check_command' in services.cfg file. What should be 'check_command' in services.cfg file ? Is "check_ping" ok ?
Is there anything i need to add in services.cfg file ? Any pointer how to debug this ?

Re: Host is not scheduled to be checked...

Posted: Thu Mar 30, 2017 2:06 am
by neel5481
I was debugging and found the log of "nagios.log" and below is the error.

[1490857367] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;MyHost;MyService;2;Level increased (threshold values: {1,2,3}, current value: 316) (new State: HIGH , old State: LOW)
[1490857367] Warning: Passive check result was received for service 'MyService' on host 'MyHost', but the service could not be found!
[1490857367] Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;MyHost;MyService;2;Level increased (threshold values: {1,2,3}, current value: 316) (new State: HIGH , old State: LOW)
[1490857367] External command error: Command failed

I was suspecting the issue with permissions but permission seems to be correct as below. Let me know if anything is missing.

[neel@localhost nagios]$ ls -l /usr/local/nagios/var/
total 124
drwxrwxr-x. 2 nagios nagios 6 Mar 29 11:55 archives
-rw-r--r--. 1 nagios nagios 196 Mar 30 12:31 nagios.configtest
-rw-r--r--. 1 nagios nagios 6 Mar 30 12:31 nagios.lock
-rw-r--r--. 1 nagios nagios 48698 Mar 30 12:32 nagios.log
-rw-r--r--. 1 nagios nagios 14363 Mar 30 12:31 objects.cache
-rw-r--r--. 1 nagios nagios 14363 Mar 30 12:31 objects.precache
-rw-------. 1 nagios nagios 15824 Mar 30 12:31 retention.dat
drwxrwsr-x. 2 nagios nagcmd 39 Mar 30 12:31 rw
drwxr-xr-x. 3 root root 25 Mar 29 11:55 spool
-rw-rw-r--. 1 nagios nagios 16153 Mar 30 12:41 status.dat


Just for your reference, I followed below link to setup nagios 4 on CentOS 7.
https://www.unixmen.com/install-configu ... -centos-7/

Any idea why command is getting failed ?

Re: Host is not scheduled to be checked...

Posted: Thu Mar 30, 2017 8:48 am
by tgriep
In your previous post, your service check called MyService has this host name called MyLocalHost but your messages from the nagios.log the host is called MyHost.
Are they the same host or are they different?
If they are different, you will have to create service configuration for that host/service and this message from the log

Code: Select all

Warning: Passive check result was received for service 'MyService' on host 'MyHost', but the service could not be found!
is stating that the check is a passive check but there is not a definition of that check in Nagios causing the warning.

Take a look at this link for more details on passive checks in Nagios.
https://assets.nagios.com/downloads/nag ... hecks.html

The External command failed message, we would have to see how the following command is defined on your system.

Code: Select all

PROCESS_SERVICE_CHECK_RESULT

Re: Host is not scheduled to be checked...

Posted: Thu Mar 30, 2017 8:58 am
by neel5481
Sorry it was log copy/paste issue. The host is same as "MyLocalHost" not "MyHost".

We are using the command as below.

[<timestamp>] PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_name>;<code>;<status_text>

[1490857367] PROCESS_SERVICE_CHECK_RESULT;MyLocalHost;MyService;2;Level increased (threshold values: {1,2,3}, current value: 316) (new State: HIGH , old State: LOW)

Here Code will be 0,1,2 which represent the status as OK,WARNING, CRITICAL like that and 'status_text' will be message displayed in last column of "Status Information".

Re: Host is not scheduled to be checked...

Posted: Thu Mar 30, 2017 9:31 am
by tgriep
Do you want to monitor the MyLocalHost system with an active check or a passive check?
If you want to do it passively, you will have to disable the active checks and replace the active check command with your passive check command.

I will need to see how the command

Code: Select all

PROCESS_SERVICE_CHECK_RESULT
is defined in your commands.cfg file to help out on the External command error: Command failed error.

Re: Host is not scheduled to be checked...

Posted: Thu Mar 30, 2017 12:48 pm
by neel5481
Everything works fine after disabling active check in services.cfg file.
Final hosts.cfg and services.cfg file will be as below.

define host {
host_name MyLocalHost
address 127.0.0.1
active_checks_enabled 1
passive_checks_enabled 1
use generic-host
max_check_attempts 10
check_command check-host-alive
}


define service {
host_name MyLocalHost
service_description MyService
use generic-service
check_command check_ping!3000.0,80%!5000.0,100%
check_freshness 0
active_checks_enabled 0
passive_checks_enabled 1
}

Are above configurations fine or is there any problem in future ?

Thanks in Advance.