ncpa - active check no working..

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.
Locked
charpham
Posts: 16
Joined: Fri Dec 22, 2017 2:59 pm

ncpa - active check no working..

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: ncpa - active check no working..

Post 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$
}
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
charpham
Posts: 16
Joined: Fri Dec 22, 2017 2:59 pm

Re: ncpa - active check no working..

Post 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...
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa - active check no working..

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
charpham
Posts: 16
Joined: Fri Dec 22, 2017 2:59 pm

Re: ncpa - active check no working..

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: ncpa - active check no working..

Post 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.
charpham
Posts: 16
Joined: Fri Dec 22, 2017 2:59 pm

Re: ncpa - active check no working..

Post by charpham »

thanks for your input.. I have fixed the problem.. some minor hostnaming problems I had..
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa - active check no working..

Post by lmiltchev »

I am glad to hear your issue has been resolved! I am locking this topic.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked