Page 1 of 1

check_ncpa Not Defined Anywhere - Help Please?

Posted: Tue Jul 10, 2018 10:18 am
by darenmatthews
My problem is that my configuration verification fails with error "Error: Service check command 'check_ncpa ... is not defined anywhere!"

Please can someone help me to troubleshoot this?

- I installed ncpa agent on a Windows machine successfully (I can login to the agent using https://[ip address]:5693/gui/).
- I created an ncpa.cfg file and placed it into /usr/local/nagios/etc/objects:
[root@linux objects]# pwd
/usr/local/nagios/etc/objects

[root@linux objects]# grep check_ncpa ncpa.cfg
check_command check_ncpa!-t '' -P 5693 -M system/agent_version
check_command check_ncpa!-t '' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
check_command check_ncpa!-t '' -P 5693 -M memory/virtual -w 50 -c 80 -u G
check_command check_ncpa!-t '' -P 5693 -M processes -w 150 -c 200
- I updated the commands.cfg file with this:
define command {
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
But when I run the verification I receive the following:
Running pre-flight check on configuration data...
Checking objects...
Error: Service check command 'check_ncpa!-t '' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'' specified in service 'CPU Usage' for host 'LONTEST350' not defined anywhere!
Error: Service check command 'check_ncpa!-t '' -P 5693 -M memory/virtual -w 50 -c 80 -u G' specified in service 'Memory Usage' for host 'LONTEST350' not defined anywhere!
Error: Service check command 'check_ncpa!-t '' -P 5693 -M processes -w 150 -c 200' specified in service 'Process Count' for host 'LONTEST350' not defined anywhere!
Error: Host check command 'check_ncpa!-t '' -P 5693 -M system/agent_version' specified for host 'LONTEST350' is not defined anywhere!
Thanks in advance of any help.
- Daren

Re: check_ncpa Not Defined Anywhere - Help Please?

Posted: Tue Jul 10, 2018 3:23 pm
by scottwilkerson
Are you sure you don't have multiple commands.cfg files? what is the path to the commands.cfg file in your nagios.cfg

Is this the same locations of the file you edited?

Re: check_ncpa Not Defined Anywhere - Help Please?

Posted: Wed Jul 11, 2018 3:20 am
by darenmatthews
Hi Scott,

Thanks for replying, much appreciated. Here is the path to commands.cfg in nagios.cfg:
[root@linux etc]# grep commands.cfg nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
I have one commands.cfg (plus the sample which isn't referenced in nagios.cfg):
[root@linux etc]# find / -name commands.cfg
/tmp/nagios-4.1.1/sample-config/template-object/commands.cfg
/usr/local/nagios/etc/objects/commands.cfg
The verification failure started just after I had uploaded ncpa.cfg (I also added the path to this in nagios.cfg):
[root@linux etc]# grep ncpa.cfg nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/ncpa.cfg
The only place where check_ncpa is defined is in ncpa.cfg:
[root@linux]# grep 'check_ncpa' *.*
ncpa.cfg: check_command check_ncpa!-t '' -P 5693 -M system/agent_version
ncpa.cfg: check_command check_ncpa!-t '' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
ncpa.cfg: check_command check_ncpa!-t '' -P 5693 -M memory/virtual -w 50 -c 80 -u G
ncpa.cfg: check_command check_ncpa!-t '' -P 5693 -M processes -w 150 -c 200
I'm baffled really

Re: check_ncpa Not Defined Anywhere - Help Please?

Posted: Wed Jul 11, 2018 6:48 am
by darenmatthews
OK problem solved. It was a simple error / oversight. I did not have this in my commands.cfg file:
define command {
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
Many thanks for the reponse
- Daren

Re: check_ncpa Not Defined Anywhere - Help Please?

Posted: Wed Jul 11, 2018 8:20 am
by scottwilkerson
darenmatthews wrote:OK problem solved. It was a simple error / oversight. I did not have this in my commands.cfg file:
define command {
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
Many thanks for the reponse
- Daren
Excellent Locking