Page 1 of 1

An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

Posted: Tue Oct 29, 2019 3:18 pm
by meganwilliford
I've run into an error I have not seen yet. NCPA checks are working for CPU, Memory, and Disk however, any checks verifying service status is coming back as "An error occurred:HTTP Error 500: INTERNAL SERVER ERROR". The remote server is RHEL 6.10 using NCPA 2.1.9.

Results from the nagios server command line:

[root@nagiosserver ~]# /usr/local/nagios/libexec/check_ncpa.py -H [remoteserver] -t 'generictoken' -P 5693 -M 'services' -q 'service=ncpa_listener,status=running' -v
Connecting to: https://[remoteserver]:5693/api/services/?token=generictoken&check=1&service=ncpa_listener&status=running
An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

I've also tested the ncpa connection using https://[remoteserver]:5693/testconnect/?token=generictoken and the value: "Success."

Any ideas on what the issue might be?

Re: An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

Posted: Tue Oct 29, 2019 4:05 pm
by lmiltchev
Can you post the ncpa.cfg and ncpa_listener.log? Also, run the following commands and show the output:

On the remote box:

Code: Select all

cat /etc/*release
which python
python --version
On the Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H [remoteserver] -t 'generictoken' -P 5693 -M 'services' -l -v

Re: An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

Posted: Wed Nov 06, 2019 11:52 am
by meganwilliford
Attached is the ncpa_listener.log, ncpa.cfg, and troubleshooting text file with the command outputs. I ran a similar command for processes from the Nagios XI server and had no issues: /usr/local/nagios/libexec/check_ncpa.py -H [remoteserver] -t 'generictoken' -P 5693 -M 'processes' -l -v.

Re: An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

Posted: Wed Nov 06, 2019 1:42 pm
by lmiltchev
I am not sure what 'nails' is, but I see permission issues in the log:
2019-11-04 10:31:27,068 20131 ERROR [Errno 13] Permission denied: '/etc/init.d/nails'
In el6 in order to get currently running services, NCPA checks the init.d files. Let's check the permissions on these. Run the following command on the client and show the output:

Code: Select all

ls -lad /etc/init.d
ls -la /etc/init.d
umask
sestatus
Can you view the services if you change:

Code: Select all

uid = nagios
gid = nagios
to:

Code: Select all

uid = root
gid = root
and restart the ncpa_listener service?

Are you using IPv4, IPv6 or both on this system?

Re: An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

Posted: Wed Nov 06, 2019 3:52 pm
by meganwilliford
Attached is the output of the permissions.

Changing the uid and gid to root worked. I was able to list all of the services.

IPv4 is used.

Re: An error occurred:HTTP Error 500: INTERNAL SERVER ERROR

Posted: Wed Nov 06, 2019 4:21 pm
by lmiltchev
I am able to list all of the services on my test RHEL machine, even with:

Code: Select all

uid = nagios
gid = nagios
I wonder if you made any changes to the system, in order to harden the server...

Note: I meant to ask you to run:

Code: Select all

ls -la /etc/init.d/
or

Code: Select all

cd /etc/init.d/
ls -la
not this:

Code: Select all

ls -la /etc/init.d
Sorry about that. I wanted to see the permissions of the files under the /etc/init.d/ directory.
Changing the uid and gid to root worked. I was able to list all of the services.
I am glad to hear that! Is this a "workaround" that you would consider? Is it safe to close this topic?