Remote Host Service Monitoring Trouble

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
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Remote Host Service Monitoring Trouble

Post by Explodistan »

So I installed NCPA on a windows server to monitor critical services and cpu percentages. After I configured everything on the Nagios server end to look at the computer I set up, the services still show the return code of "Return code of 127 is out of bounds. Check if plugin exists". It is passing passive data though as every five minutes the machine shows green on Nagios, with information on the hardware and services running. It just goes back to the return code of 127 after the next active check.

So either 1 I am at a loss since everything seems to be configured ok on both ends

or

2.) Can I just use passive checks for both hardware and services running on the server I am trying to monitor?
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Re: Remote Host Service Monitoring Trouble

Post by Explodistan »

Issue solved. It ended up being a problem in the ncpa.conf file on the windows machine. The url was set to XXX.XXX.XXX.XXX instead of XXX.XXX.XXX.XXX/nagios which ended up in the program not being able to find the server. I had looked in the .log file and saw that it was having trouble finding the server. Who knew .log files where so helpful :p
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Re: Remote Host Service Monitoring Trouble

Post by Explodistan »

ok, so one more issue. I am testing out monitoring a specific service over NCPA. Everything is set now as the initial configuration commands all work. I input a service through check_ncpa.py to monitor a random service that is running on my test machine, but it is returning the same frustrating 127 error. Here is the configuration I have in Nagios for the system

define host {
use windows-server
host_name Jeff Test
address XXX.XXX.XXX.XXX
check_command check_ncpa!-t 'XXX' -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 Jeff Test
service_description CPU Usage
check_command check_ncpa!-t 'XXX' -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 Jeff Test
service_description Memory Usage
check_command check_ncpa!-t 'XXX' -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 Jeff Test
service_description Critical Service
check_command check_ncpa!-t 'XXX' -P 5693 -M service -q service=ibtsiva,status=running,match=search
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Remote Host Service Monitoring Trouble

Post by mbellerue »

Can you go to the command line in your Nagios Core server, navigate to your Nagios plugins directory (usually /usr/local/nagios/libexec/), and try to run your check command?

Code: Select all

./check_ncpa.py -H <HostMachineIP> -t '<your token>' -M 'cpu/percent' -w 20 -c 40 -q 'aggregate=avg' -v 
I'd just like to verify that the NCPA plugin is installed, and the check itself works properly. Also the -v switch will give us additional output to work with.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Re: Remote Host Service Monitoring Trouble

Post by Explodistan »

Ah, so we have a problem. When I input the code, this is what happens.

sudo ./check_ncpa.py -H 'XXX.XXX.XXX.XXX' -t 'XXXXXX' -M 'cpu/percent' -w 20 -c 40 -q 'aggregate=avg' -v
sudo: ./check_ncpa.py: command not found

and this happens with all the ./check_ncpa.py commands. This command does exist and is located in the nagios/libexec folder.
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Re: Remote Host Service Monitoring Trouble

Post by Explodistan »

Also, when I try to run it from under the libexec directory it returns

sudo ./check_ncpa.py -H 'XXXXXXXX' -t 'XXXXXXXX' -M 'cpu/percent' -w 20 -c 40 -q 'aggregate=avg' -V
/usr/bin/env: ‘python\r’: No such file or directory
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remote Host Service Monitoring Trouble

Post by scottwilkerson »

I would check first if line endings are set to "unix" in the script. Make sure they are not set to "dos". Open the plugin in "vi" editor

Code: Select all

vi ./check_ncpa.py 
type:

Code: Select all

:set ff=unix
and hit "Enter". Save and exit by typing:

Code: Select all

:wq
and hitting "Enter" again. Test your plugin again.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Re: Remote Host Service Monitoring Trouble

Post by Explodistan »

ok I did that and the fix seems to have worked

./check_ncpa.py -H XXX.XXX.XXX.XXX -t 'XXXXXX' -M 'services' -q 'service=AdobeARMservice,status=running'
OK: AdobeARMservice is running

So it seems like the plugin is now running correctly. Should I restart any of the services on my Nagios server?
Explodistan
Posts: 11
Joined: Mon Aug 05, 2019 2:23 pm

Re: Remote Host Service Monitoring Trouble

Post by Explodistan »

So I went and reconfigured the configuration on the Nagios server and the plugin is working fine now. I'll write down this change. The only other question I have is is there a document for what commands are supported with NCPA? Like what checks it can do?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remote Host Service Monitoring Trouble

Post by scottwilkerson »

Explodistan wrote:The only other question I have is is there a document for what commands are supported with NCPA? Like what checks it can do?
The documentation is here
https://www.nagios.org/ncpa/help.php
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked