Passive checks with NCPA and NRDP
Passive checks with NCPA and NRDP
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
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
Re: Passive checks with NCPA and NRDP
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.Do I need to create this static service? Shouldn't it be created when it's received?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Passive checks with NCPA and NRDP
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
}
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
}
Re: Passive checks with NCPA and NRDP
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!
Re: Passive checks with NCPA and NRDP
Thanks! That helped but now I have another problem.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 }
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?
Re: Passive checks with NCPA and NRDP
What are the permissions on the checkresults directory?
Can you also run the following commands and show us the output?
Code: Select all
ls -ld /usr/local/nagios/var/spool/checkresults
Code: Select all
getenforce
grep nag /etc/group
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Passive checks with NCPA and NRDP
Permissions on the checkresults are:
Running getenforce shows disabled.
/etc/group
Code: Select all
drwxrwxr-x nagios apache
/etc/group
Code: Select all
uucp:x:14:nagios
apache:x:48:nagios
sysmon:x:500:nagios
Re: Passive checks with NCPA and NRDP
Can you post the "default-service" config?
FYI, the "default" permissions/groups are different than the ones on your system... I have:
Are you actually using Nagios Core or some other monitoring solution, that uses nagios?
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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Passive checks with NCPA and NRDP
I have not installed Nagios in the default paths and I'm using different group and usernames.
Here is the service template default-service:
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
}
Re: Passive checks with NCPA and NRDP
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.[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
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!