Passive checks with NCPA and NRDP

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
monitor86
Posts: 6
Joined: Thu Mar 12, 2015 3:17 am

Passive checks with NCPA and NRDP

Post by monitor86 »

Hi everyone!

I have always found a solution for my problem before thanks to this wonderful forum but this time I can't find a solution.

We are running Nagios core and this works great. Unfortunately we have a lot of Windows servers in our environment so we need to use check_nrpe to monitor CPU usage + a lot of other stuff. This is working most of the time but sometimes we get check timeout. Since this is an active check we have been thinking about using passive checks instead. Hopefully this will remove the timeout issues.

So, I have installed NCPA on a Windows server and configured NRPD on the Nagios server. On the Windows host I can't see any errors in the NCPA log. Only that the checks was sent successfully.
However at the Nagios server I see the following:

[1426124423] Error: Got check result for service 'Testcpu' on host 'Windowstest'. Unable to find service

Do I need to create this static service? Shouldn't it be created when it's received?

My ncpa.cfg:

[listener]
uid = nagios
certificate = adhoc
loglevel = debug
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid

[passive]
uid = nagios
handlers = nrdp
loglevel = debug
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid

[nrdp]
token =testtoken
hostname =Windowstest
parent =https://10.100.200.90/nrdp

[api]
community_string =

[plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
.ps1 = powershell -ExecutionPolicy Unrestricted -File $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo

[passive checks]
Testcpu|Windowstest = /cpu/percent --warning 20 --critical 30
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Passive checks with NCPA and NRDP

Post by lmiltchev »

Do I need to create this static service? Shouldn't it be created when it's received?
Yes. If you were using Nagios XI, this check would appear under the Unconfigured Objects. Then you would run the "Unconfigured Objects" wizard to configure your host/service (create the config). In Nagios Core, you will need to create the config manually.
Be sure to check out our Knowledgebase for helpful articles and solutions!
monitor86
Posts: 6
Joined: Thu Mar 12, 2015 3:17 am

Re: Passive checks with NCPA and NRDP

Post by monitor86 »

Hi,

Yes I have created the check manually but I still get 'Unable to find service'.
From services.cfg

define service{
use default-service
host_name Windowstest
service_description Testcpu
check_command check_dummy
active_checks_enabled 0
passive_checks_enabled 1
parallelize_check 1
obsess 1
}
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Passive checks with NCPA and NRDP

Post by lmiltchev »

I believe you have the hostname and service description swapped. You need to have:

Code: Select all

define service{
use default-service
host_name Testcpu
service_description Windowstest
check_command check_dummy
active_checks_enabled 0
passive_checks_enabled 1
parallelize_check 1
obsess 1
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
monitor86
Posts: 6
Joined: Thu Mar 12, 2015 3:17 am

Re: Passive checks with NCPA and NRDP

Post by monitor86 »

lmiltchev wrote:I believe you have the hostname and service description swapped. You need to have:

Code: Select all

define service{
use default-service
host_name Testcpu
service_description Windowstest
check_command check_dummy
active_checks_enabled 0
passive_checks_enabled 1
parallelize_check 1
obsess 1
}
Thanks! That helped but now I have another problem.

In the nagios.log I can see this:

[1426233349] PASSIVE SERVICE CHECK: Windowstest;Testcpu;2;(Service check timed out after 0.00 seconds)

I found that it is a bug in Nagios Core 4.0.3 but I'm running 4.0.4. Is it something else?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Passive checks with NCPA and NRDP

Post by lmiltchev »

What are the permissions on the checkresults directory?

Code: Select all

ls -ld /usr/local/nagios/var/spool/checkresults
Can you also run the following commands and show us the output?

Code: Select all

getenforce
grep nag /etc/group
Be sure to check out our Knowledgebase for helpful articles and solutions!
monitor86
Posts: 6
Joined: Thu Mar 12, 2015 3:17 am

Re: Passive checks with NCPA and NRDP

Post by monitor86 »

Permissions on the checkresults are:

Code: Select all

drwxrwxr-x nagios apache
Running getenforce shows disabled.

/etc/group

Code: Select all

uucp:x:14:nagios
apache:x:48:nagios
sysmon:x:500:nagios
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Passive checks with NCPA and NRDP

Post by lmiltchev »

Can you post the "default-service" config?

FYI, the "default" permissions/groups are different than the ones on your system... I have:

Code: Select all

ls -ld /usr/local/nagios/var/spool/checkresults
drwxrwsr-x 2 nagios nagcmd 20480 May 15  2014 /usr/local/nagios/var/spool/checkresults

grep nag /etc/group
nagios:x:500:nagios,apache,snmptt
nagcmd:x:501:nagios,apache,snmptt
Are you actually using Nagios Core or some other monitoring solution, that uses nagios?
Be sure to check out our Knowledgebase for helpful articles and solutions!
monitor86
Posts: 6
Joined: Thu Mar 12, 2015 3:17 am

Re: Passive checks with NCPA and NRDP

Post by monitor86 »

I have not installed Nagios in the default paths and I'm using different group and usernames.

Here is the service template default-service:

Code: Select all

defince service{
is_volatile 0
max_check_attempts 3
check_interval 5
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 0
notification_period 24x7
notification_options c,w,u,r,f,s
notifications_enabled 1
register 0
name default-service
}
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Passive checks with NCPA and NRDP

Post by lmiltchev »

[listener]
uid = nagios
certificate = adhoc
loglevel = debug
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid

[passive]
uid = nagios
handlers = nrdp
loglevel = debug
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid
Since, you are not using the default "nagcmd" group, you should probably change the gid to whatever custom group you use and restart the NCPA services on the Windows box.

Can you view the NRDP web interface on the nagios server?

Code: Select all

http://nagios ip/nrpd/
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked