Remote Host Service Monitoring Trouble

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Remote Host Service Monitoring Trouble

Postby Explodistan » Sat Aug 10, 2019 3:54 pm

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

Postby Explodistan » Sat Aug 10, 2019 4:27 pm

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

Postby Explodistan » Sat Aug 10, 2019 5:01 pm

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

Re: Remote Host Service Monitoring Trouble

Postby mbellerue » Mon Aug 12, 2019 10:23 am

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!
User avatar
mbellerue
 
Posts: 404
Joined: Fri Jul 12, 2019 11:10 am

Re: Remote Host Service Monitoring Trouble

Postby Explodistan » Mon Aug 12, 2019 3:00 pm

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

Postby Explodistan » Mon Aug 12, 2019 3:05 pm

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

Re: Remote Host Service Monitoring Trouble

Postby scottwilkerson » Mon Aug 12, 2019 4:36 pm

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15778
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Remote Host Service Monitoring Trouble

Postby Explodistan » Mon Aug 12, 2019 5:07 pm

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

Postby Explodistan » Mon Aug 12, 2019 5:13 pm

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

Re: Remote Host Service Monitoring Trouble

Postby scottwilkerson » Tue Aug 13, 2019 6:35 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15778
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: fsodah and 11 guests