CGI Error on Centos 7

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
klingsor
Posts: 5
Joined: Thu Sep 21, 2017 5:02 pm

CGI Error on Centos 7

Post by klingsor »

I have installed nagios core 4.3.2-8.el7 from epel and done the SELinux config suggested by the startup script. Subsequently the nagios daemon started and looks ok:

Code: Select all

nagios.service - Nagios Network Monitoring
   Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled)
   Active: active (running) since Thu 2017-09-21 22:56:33 CEST; 1h 11min ago
     Docs: https://www.nagios.org/documentation/
  Process: 11601 ExecStopPost=/bin/rm -f /var/spool/nagios/cmd/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 11599 ExecStopPost=/bin/rm -f /var/spool/nagios/status.dat (code=exited, status=0/SUCCESS)
  Process: 11596 ExecStopPost=/bin/rm -f /var/run/nagios/nagios.pid (code=exited, status=0/SUCCESS)
  Process: 11595 ExecStopPost=/usr/bin/rm -f /var/spool/nagios/cmd/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 11605 ExecStart=/usr/sbin/nagios -d /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
  Process: 11603 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
 Main PID: 11606 (nagios)
   CGroup: /system.slice/nagios.service
           ├─11606 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
           ├─11607 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11608 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11609 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11610 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11611 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11612 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           └─11613 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
Still the nagios home page shows "Unable to get process status" and "End of script output before headers" is written to the apache error log. Setting SELinux to permissive does not help and the permissions seem ok, as installed by RPM.
Any suggestions where to start looking?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: CGI Error on Centos 7

Post by scottwilkerson »

Does the rest of the UI work correctly? It is possible that the RPM packagers missed something when creating the SELinux context that is required for the pid check on the landing page.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
klingsor
Posts: 5
Joined: Thu Sep 21, 2017 5:02 pm

Re: CGI Error on Centos 7

Post by klingsor »

Actually all CGI calls out of Apache fail and "Internal Server Error" being displayed.
klingsor
Posts: 5
Joined: Thu Sep 21, 2017 5:02 pm

Re: CGI Error on Centos 7

Post by klingsor »

Calling the Scripts from the sidebar links results in HTTP 500, i.e. nothing in the GUI works. Calling the scripts directly from command line works fine, though.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: CGI Error on Centos 7

Post by scottwilkerson »

If you run the following is there any clue in the httpd logs?

Code: Select all

tail -100 /var/log/httpd/error_log
If not could you zip up and post the contents of the /etc/httpd/conf.d
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
klingsor
Posts: 5
Joined: Thu Sep 21, 2017 5:02 pm

Re: CGI Error on Centos 7

Post by klingsor »

Thanks for pointing me to the httpd config, the problem was setting SuexecUserGroup for another application on server level.
Now it will work, but only when setting SELinux to permissive. Did I miss something on installation?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: CGI Error on Centos 7

Post by scottwilkerson »

klingsor wrote:Now it will work, but only when setting SELinux to permissive. Did I miss something on installation?
This is going to be required for the apache user to be able to access some required files
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
klingsor
Posts: 5
Joined: Thu Sep 21, 2017 5:02 pm

Re: CGI Error on Centos 7

Post by klingsor »

Obviously, guess I will then have to either grep through the audit logs until everything works, or look for a policy package to install. Thanks for helping out anyway, much appreciated.
Locked