Remote Host Service Monitoring Trouble
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Remote Host Service Monitoring Trouble
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?
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?
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Re: Remote Host Service Monitoring Trouble
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
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Re: Remote Host Service Monitoring Trouble
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
}
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
}
Re: Remote Host Service Monitoring Trouble
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?
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.
Code: Select all
./check_ncpa.py -H <HostMachineIP> -t '<your token>' -M 'cpu/percent' -w 20 -c 40 -q 'aggregate=avg' -v
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Re: Remote Host Service Monitoring Trouble
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.
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.
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Re: Remote Host Service Monitoring Trouble
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
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Remote Host Service Monitoring Trouble
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
type:
and hit "Enter". Save and exit by typing:
and hitting "Enter" again. Test your plugin again.
Code: Select all
vi ./check_ncpa.py
Code: Select all
:set ff=unix
Code: Select all
:wq
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Re: Remote Host Service Monitoring Trouble
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?
./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?
-
- Posts: 11
- Joined: Mon Aug 05, 2019 2:23 pm
Re: Remote Host Service Monitoring Trouble
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?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Remote Host Service Monitoring Trouble
The documentation is hereExplodistan 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?
https://www.nagios.org/ncpa/help.php