Nagios cgi problem on Fedora 2


#1

Hi,

Im trying to install nagios on a fedora 2 machine for 2 weeks now but I can’t get it to work properly. I guess installing it isn’t the problem. I used the tarball, compiled it and configured it as the doc files say.

When I start nagios in my browser, I get this error (after loging in) when i try to open a cgi file:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log."

I checked the nagios configuration with this command:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

The output is:

"Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check"

So if things look okay, why won’t it work? I also checked my apache error log. The only error I get is this one:

“[Wed Dec 14 19:55:38 2005] [warn] RSA server certificate CommonName (CN) `plesk’ does NOT match server name!?
[Wed Dec 14 19:55:38 2005] [notice] Apache/2.0.51 (Fedora) configured – resuming normal operations”

And i don’t know if this has anything to do with nagios.

This is what i’ve put in my httpd.conf:

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

<Directory “/usr/local/nagios/sbin”>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Alias /nagios /usr/local/nagios/share

<Directory “/usr/local/nagios/share”>
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Does anyone know what could be the problem? Cause I’m close to giving up now, lol.

Thanks,

Michiel

Edited ]


#2

Here’s one thing: you need to place the Alias to your share/ directory BEFORE your scriptAlias to your sbin/ directory. Apache encounters a parsing error otherwise. Let us know if this does anything.


#3

Ok, I changed the scripAliases like you said, now I get this error when I restart apache:

Stopping httpd: OK ]
Starting httpd: [Thu Dec 15 09:07:13 2005] [warn] The ScriptAlias directive in /etc/httpd/conf/httpd.conf at line 611 will probably never match because it overlaps an earlier Alias.
OK ]

So I guess I’m doing something wrong here, but I cant find any duplicate Aliases. This is what the httpd.conf looks like now (with line numbers)

588 # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
589 # CGI directory exists, if you have that configured.
590 #
591 <Directory "/var/www/cgi-bin">
592     AllowOverride None
593     Options None
594     Order allow,deny
595     Allow from all
596 </Directory>
597
598 Alias /nagios /usr/local/nagios/share
599
600 <Directory "/usr/local/nagios/share">
601 Options None
602 AllowOverride None
603 Order allow,deny
604 Allow from all
605 AuthName "Nagios Access"
606 AuthType Basic
607 AuthUserFile /usr/local/nagios/etc/htpasswd.users
608 Require valid-user
609 </Directory>
610
**611 scriptAlias /nagios/cgi-bin /usr/local/nagios/sbin**
612
613 <Directory "/usr/local/nagios/sbin">
614 Options ExecCGI
615 AllowOverride None
616 Order allow,deny
617 Allow from all
618 AuthName "Nagios Access"
619 AuthType Basic
620 AuthUserFile /usr/local/nagios/etc/htpasswd.users
621 Require valid-user
622 </Directory>
623
624 #

Any ideas on what Im doing wrong?

Edited Thu Dec 15 2005, 09:25AM ]


#4

Ah, sh-t, I was wrong. Your config was right the first time in that the scriptAlias should come before. My deepest apologies; I was rather rushed and not thinking straight when I made my suggestiong. Note to self: double-checks the docs next time.

And now, taking a closer look at your configs, I found something else wrong. You have the contents of what should be .htaccess in your sbin/ and share/ directories written into your Apache config. The last four lines in both of those Alias scripts there don’t belong in the Apache config. They belong in their own separate file in the directories for which your are creating your aliases.

I’m sorry again for not looking at your problem more closely.


#5

Hey no problem! I’m out of solutions so its awesome that you try to help me. I changed the httpd.conf back to its original state.

So if I get this right, I should create a .htaccess file in the /share and /sbin directorys? And wich lines (from the httpd.conf) should be in those files? Could you be more specific?

Thanks a lot for your help!


#6

Ok, I’ve created two .htaccess files, the first in the /sbin directory and the other one in the /share directory. I’ve cut the last four lines from the httpd.conf and put them in those files:

AuthName "Nagios Access"uthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

Restarted apache and nagios, and I still have the some error as in my first post.

This problem is driving me crazy! I’don’t even get an error so I could figure out what the problem is :evil:


#7

I hope this is not a typo:
AuthName "Nagios Access"uthName “Nagios Access” or is it, so double check your .htaccess

You also need to make sure that apache is looking for a .htaccess file
AccessFileName is what in the /etc/httpd/conf/httpd.conf file?

Did you create the /usr/local/nagios/etc/htpasswd.users file? What are the permissions on that file?
Is nagios running?
/etc/rc.d/init.d/nagios status
If not, then start it.
/etc/rc.d/init.d/nagios start
Now make sure it’s running.
/etc/rc.d/init.d/nagios status
If not, then your config files are screwed up and you need to look at each and every one for a typo.


#8

Something went wrong with the copy paste I guess, it looks okay in the .htacces files.

AccessFileName is set to .htaccess in the httpd.conf

I have created the .htpasswd.users, the permisions look like this:

-rwxrwxrwx 1 root root 20 Dec 13 09:49 htpasswd.users

Nagios is running and doesn’t give any errors when I restart it:

[[email protected]]# /etc/rc.d/init.d/nagios status
PID TTY TIME CMD
8512 ? 00:00:12 nagios

Edited Sat Dec 17 2005, 12:05PM ]


#9

You said you logged in but get the “internal error” so that means that authentication is working. ARe you able to click on the “home” and “documentation” links without error?
If so,
tail -f /etc/httpd/logs/error_log and also another on the access.log
and attempt to open a cgi page.