Config Syntax Issue : ncpa.cfg

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
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Config Syntax Issue : ncpa.cfg

Post by nickanderson82 »

Hello,

I am trying to get a disk check running on the basic ncpa.cfg example. I can't get the syntax right or I need some direction on what to add on the client/ncpa (windows server) side.

How do you add a disk size check to the config file
example of memory usage:
define service {
host_name NCPA 2 Host
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
}

This is what I came up for the disk check.... it errors out

define service {
host_name xxxxxx
service_description Disk Usage
check_command check_ncpa!-t xxxxxxxx -P 5693 -M api/disk/logical/c:|/used_percent -w 80 -c 90
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

I also tried adding other plugins to the file but would get couldn't access port. But I am confused as to where to add the plugins on the client side server. Do I add it to C:\Program Files (x86)\Nagios\NCPA\plugins ?

I am probably sounding all over the place but I just completed my first install of Nagios Core. I have one server reporting the 3 checks from the example and have a test url reporting.
kyang

Re: Config Syntax Issue : ncpa.cfg

Post by kyang »

Welcome back! @nickanderson82

Are you using the NCPA interface to get that check?
In the UI, there's an option for "Run as a Nagios Check" --> Which allows you to view it in an alternative format.

For example, on my Linux machine, I used the API in the UI. Here's my result of how to run the check_command

Code: Select all

check_ncpa.py -H 192.168.4.42 -t '<your token>' -M 'disk/logical/|boot/used_percent' -w 60 -c 70
check_command would be something like this

Code: Select all

check_ncpa!-t <token> -P 5693 -M 'disk/logical/|boot/used_percent' -w 60 -c 70
So it looks like you are missing some quotes? I don't think the API part is needed.

Code: Select all

check_command    check_ncpa!-t xxxxxxxx -P 5693 -M 'disk/logical/c:|/used_percent' -w 80 -c 90
As for the plugins part, what plugins are you putting trying to run? Or I should say what information do you want to receive from your windows server?
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: Config Syntax Issue : ncpa.cfg

Post by nickanderson82 »

On the server the nrdp.cfg file:
#
# 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 <-------(This is what i was trying to mimic in the ncpa.cfg file)
%HOSTNAME%|Swap Usage = /memory/swap --warning 60 --critical 80
%HOSTNAME%|Memory Usage = /memory/virtual --warning 80 --critical 90
%HOSTNAME%|Process Count = /processes --warning 300 --critical 400

-----

So I edited the define service in the cfg file to be:

define service {
host_name 842714-db3
service_description Disk Usage
check_command check_ncpa!-t xxxxxxx -P 5693 -M 'disk/logical/c:|/used_percent' -w 80 -c 90 <----(I left the 'xx' quotations in)
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}
-------------------------

This is what I see in the status :
(Return code of 127 is out of bounds - plugin may be missing : (No output on stdout) stderr: /bin/sh: /used_percent’: No such file or directory))
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: Config Syntax Issue : ncpa.cfg

Post by nickanderson82 »

Now I am getting this:
Disk Usage
UNKNOWN 09-29-2017 13:10:34 0d 0h 4m 48s 5/5 The node (c:
kyang

Re: Config Syntax Issue : ncpa.cfg

Post by kyang »

Perhaps the c should be uppercase C:

Must have been a typo on my part.

Code: Select all

check_command check_ncpa!-t xxxxxxx -P 5693 -M 'disk/logical/C:|/used_percent' -w 80 -c 90
Have you tried using the Web interface for NCPA?

https://hostaddress:5693
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: Config Syntax Issue : ncpa.cfg

Post by nickanderson82 »

Yes, it was all syntax.... uppercase C not lower case c...ugh... Thanks Again!
kyang

Re: Config Syntax Issue : ncpa.cfg

Post by kyang »

Awesome! Haha, yeah it happens to us all. Even I missed that, knowing you are using Windows! So the drives are always uppercase.

Am I able to close this thread or do you have more questions?
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: Config Syntax Issue : ncpa.cfg

Post by nickanderson82 »

Yes go ahead and close. Thanks again.
kyang

Re: Config Syntax Issue : ncpa.cfg

Post by kyang »

Closing as resolved! Feel free to create a new thread if you have more questions!

Thanks for using the Nagios Support Forum!
Locked