Page 1 of 1

ncpa - active check no working..

Posted: Tue Jan 09, 2018 2:50 pm
by charpham
Hi I just starting to learn nagios core and now want to start to monitor windows machines..

I have set up ncpa (active and passive) and I getting the following message which I am not sure how to troubleshoot.

from the logfile on the nagios server
"HOST NOTIFICATION: nagiosadmin;galagon.charpham.local;DOWN;notify-host-by-email;The node (agent_version$) requested does not exist. You may be trying to access the 'agent_version' node"

I am monitoring a wndows 10 machine. the active checks for CPU, Memory, disk usage checks are successful..

If I do the following from the Nagios Server, I get a successful response for "agent_version"
./check_ncpa.py -H 10.10.0.36 -t 'mytoken' -P 5693 -M system/agent_version
OK: Agent_version was ['2.1.1']

here is my ncpa.cfg file on the nagios server
#[passive]
#handlers = nrdp

#[nrdp]
#parent = http:/10.10.0.36/nrdp/
#token = mytoken
#hostname = host1


define host {
host_name host1
address 10.10.0.36
check_command check_ncpa!-t 'mytoken' -P 5693 -M system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contacts nagiosadmin
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1
}

define service {
host_name host1
service_description CPU Usage
check_command check_ncpa!-t 'mytoken' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}
......



Here is my config file on the Windows side
#
# AUTO GENERATED NRDP CONFIG FROM WINDOWS INSTALLER
#

[passive checks]

# Host check - This is to stop "pending check" status in Nagios
%HOSTNAME%|__HOST__ = system/agent_version

# Service checks
%HOSTNAME%|CPU Usage = cpu/percent --warning 80 --critical 90 --aggregate avg
%HOSTNAME%|Disk Usage = disk/logical/C:|/used_percent --warning 80 --critical 90 --units Gi
%HOSTNAME%|Swap Usage = memory/swap --warning 60 --critical 80 --units Gi
%HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count = processes --warning 300 --critical 400

Re: ncpa - active check no working..

Posted: Tue Jan 09, 2018 5:00 pm
by cdienger
How is the command defined in commands.cfg? I was able to get this to work with:

Code: Select all

define host {
host_name host1
address 192.168.3.246
check_command check_ncpa!password!-M system/agent_version
max_check_attempts 5
check_interval 1
retry_interval 1
check_period 24x7
contacts nagiosadmin
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1
}
and:

Code: Select all

define command{
        command_name check_ncpa
        command_line /usr/local/nagios/libexec/check_ncpa.py -H $HOSTADDRESS$ -t $ARG1$ -P 5693 $ARG2$
}

Re: ncpa - active check no working..

Posted: Tue Jan 09, 2018 6:47 pm
by charpham
thanks for your response
Hmm...
I added the following to the commands.cfg
command_line /usr/local/nagios/libexec/check_ncpa.py -H $HOSTADDRESS$ -t $ARG1$ -P 5693 $ARG2$ and it seems to break all of the services for the host.

This is how I had it in my commands.cfg file

#checking windows host using NCPA commands
define command{
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}

I also kept the same configuration in the host file ncpa.cfg
define host {
host_name host1
address 10.10.0.36
check_command check_ncpa!-t 'password' -P 5693 -M system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contacts nagiosadmin
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1

hmm not sure what is happening...

Re: ncpa - active check no working..

Posted: Wed Jan 10, 2018 12:05 pm
by lmiltchev
What kind of check do you want the "agent_version" to be - active or passive? Currently, you have it defined as both. You have an active check, defined on the nagios side of things:

Code: Select all

define host {
host_name host1
address 10.10.0.36
check_command check_ncpa!-t 'mytoken' -P 5693 -M system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contacts nagiosadmin
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1
}
and you have a passive check, defined on the ncpa side of things:

Code: Select all

%HOSTNAME%|__HOST__ = system/agent_version
You could use check_ping for your host active check instead of check_ncpa, and set up the agent_version check as a passive service check, for example:

Code: Select all

# Service checks
%HOSTNAME%|Agent Version = /system/agent_version

Re: ncpa - active check no working..

Posted: Wed Jan 10, 2018 4:47 pm
by charpham
Hi Thanks for your response..

I would like "...system/agent_version" only to be passive.. However in my nagios server ncpa.cfg (active checks), if I remove the statements regarding "agent_version" Nagios fails to load.. Here is what my ncpa.cfg file looks like.. not sure If I have the proper syntax

#[passive]
#handlers = nrdp

#[nrdp]
#parent = http:/ip address/nrdp/
#token = mytoken
#hostname = host1

############# HOST DEFINITIONS####################
define host{
use windows-server ; Inherit default values from a template
host_name host1 ; The name we're giving to this server
alias host1.local ; A longer name for the server
address 10.10.0.36 ` ; IP address of the server
}

############ Service Definitions#################

define service {
host_name host1.local
service_description CPU Usage
check_command check_ncpa!-t 'mytoken' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

define service {
host_name host1.local
service_description Memory Usage
check_command check_ncpa!-t 'mytoken' -P 5693 -M memory/virtual -w 50 -c 80 -u G
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

define service {
host_name host1.local
service_description Process Count
check_command check_ncpa!-t 'mytoken' -P 5693 -M process -w 300 -c 400
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1

Re: ncpa - active check no working..

Posted: Wed Jan 10, 2018 5:51 pm
by dwhitfield
What's the error message when it fails to load? I suspect that you have that service in a servicegroup or have something else referencing that service. If you get rid of the references, I bet it will work. The error message when you start nagios should tell you "exactly" what the issue is.

Re: ncpa - active check no working..

Posted: Fri Jan 12, 2018 2:42 pm
by charpham
thanks for your input.. I have fixed the problem.. some minor hostnaming problems I had..

Re: ncpa - active check no working..

Posted: Fri Jan 12, 2018 4:02 pm
by lmiltchev
I am glad to hear your issue has been resolved! I am locking this topic.