Can't view cgi.cfg

I get this everytime I try to open any page in nagios

Error: Could not open CGI config file ‘/usr/local/nagios/etc/cgi.cfg’ for reading!

and sometimes i have it trying to download the .cgi file instead of opening in the browser.

I am using fc3, and trying to open with firefox

nagios/docs/installweb.html
nagios/docs/cgiauth.html
check permission on the files.

Your probally having the same problem as I am if your using FC3 - I cant solve it … so if you have been able to … let me know!!!

Permission’s on the file are ??
This is what mine are.
drwxrwxr-x 2 nagios nagios 4096 Apr 2 12:42 ./
drwxrwxr-x 9 nagios nagios 4096 Mar 11 09:40 …/
-rw-rw-r-- 1 nagios nagios 18380 Apr 2 12:42 cgi.cfg

When you configured nagios, did you change the --with-cgiurl to something besides default?
Did you follow instructions at nagios/docs/installweb.html to setup apache for the nagios’s cgi’s?

"Configuring Web Authentication

Once you have configured the web interface properly, you’ll need to enable web server authentication for accessing the CGIs and configure user authorization information. Details on doing this can be found here.

Notice what it says there in the instructions. you’ll need to enable web server authentication for accessing the CGI’s So do you have authentication setup? Don’t try to take shortcuts, or you may never fix the problem, like JimmyK here. He’d rather just dismiss my suggestions, and criticize my attempts to help him.

If the instructions say you need to enable authentication, then that is what I did. But JimmyK, refuses to follow the instructions, and help given to him. Hopefully, my suggestions for you aren’t falling on deaf ears.

Also, what happens when you run /usr/local/nagios/bin -v /usr/local/nagios/etc/nagios.cfg
???
Edited Mon Apr 04 2005, 04:34PM ]

Again, I HAVE previously tried setting up the authentication but I still get the same error. It appears that this problem is limited to Fedora Core 3 and a search on google dons’t seem to promote any great knowledge of this problem.
Also jakked up, you say ‘you’ll need to enable web server authentication for accessing the CGI’s’ but the web server, in theory, should be able to access the CGI’s without user authenitication - its just there to prevent PEOPLE from accessing it, when its set up, - not to prevent the web server from accessing it.
So once again fretbrner, if you solve your problem please let me know!! I’ll probally dedicate a page to my website for users trying to solve the same problem I am!!

WHOO HOO! I finally found a solution to our problem:
issues.apache.org/bugzilla/show_bug.cgi?id=33504
Comment #3 is what I needed, it says:
Specifically the SELinux policy - see
fedora.redhat.com/docs/selinux-apache-fc3/ or ask on
[email protected] - try

chcon -R system_u:object_r:httpd_sys_script_exec_t /usr/local/nagios/sbin

to label the nagios scripts properly; more work will probably be needed though.
To fix my problem I ran:

chcon -R system_u:object_r:httpd_sys_script_exec_t /usr/local/nagios/etc

Thanks to laltopi on linuxquestions.org for helping me with finding the solution to this problem! Hopefully this will be the last of my problems… now ive just gotta do some further editing of my cfg files.

Check what editor you are using. JimmyK. I know this may sound strange…but I initially was using a WP to edit and change out my configs. Once I ran the -v …/etc/nagios.cfg it pointed out that the first line was null. I cracked the file and found numerous characters that were corrupt. Newbie error – maybe…solved :slight_smile: