Forum

Nagios configuration

Karsten
18 September 2011, 19:55

Hiawatha version: v7.6
Operating System: FreeBSD 7.3

Hello,

How can I translate the following Apache configuration for Nagios into Hiawatha:

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

<Directory "/usr/local/nagios/sbin">
...
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
...
</Directory>

Thanks in advance.

Karsten

Hugo Leisink
19 September 2011, 17:43
Hiawatha has no ScriptAlias option. Just use Alias for it. The equivilent of <Directory> is Directory {}. Both can be found in the manual page.
Karsten
19 September 2011, 18:11
Thanks for your answer. I tried:

VirtualHost {
...
Alias = /nagios/cgi-bin:/usr/local/nagios/sbin
Alias = /nagios:/usr/local/nagios/share
}


Then:

# hiawatha -k
Using /usr/local/etc/hiawatha
Reading hiawatha.conf
Syntax error in hiawatha.conf on line 135.


In this case line 135 is "Alias = /nagios/cgi-bin:/usr/local/nagios/sbin".

Any ideas? Help is appreciated.

Karsten

Hugo Leisink
19 September 2011, 18:38
I've implemented this feature a long time ago. For some reason, I decided at that time that the first parameter (the /nagios/cgi-bin) cannot contain a second slash. So, not path that consists of two parts or more. I don't remember why I made that decision at that time. I'll see if removing that check will cause any trouble.
Karsten
19 September 2011, 18:52
Thanks again. Unfortunately "/nagios/cgi-bin" is hard-coded in the CGIs. As far as I know this can't be parameterized in a configuration file or alike.

Karsten
Hugo Leisink
19 September 2011, 18:55
You could try it yourself also by removing line 1154 (if (strchr(host->alias->key + 1, '/') == NULL) {) in serverconfig.c.
Karsten
19 September 2011, 20:57
After removing line 1154

...
// if (strchr(host->alias->key + 1, '/') == NULL) {
return true;
// }
...


Hiawatha doesn't complain about "Alias = /nagios/cgi-bin ..." anymore. Now I can go to http://nagios.server.lan/nagios and everthing works. But the links in the left frame (see below)

...
<a href="/nagios/cgi-bin/status.cgi?hostgroup=all&amp;style=overview" target="main">Host Groups</a>
<ul>
<li><a href="/nagios/cgi-bin/status.cgi?hostgroup=all&amp;style=summary" target="main">Summary</a></li>
<li><a href="/nagios/cgi-bin/status.cgi?hostgroup=all&amp;style=grid" target="main">Grid</a></li>
...


give a 404. Very strange, or did I miss something?

Karsten
Hugo Leisink
20 September 2011, 08:49
Try switching the two Alias lines. The "Alias = /nagios:/usr/local/nagios/share" should be above the other one.
Karsten
20 September 2011, 13:14
Now it works. But after removing line 1154 in serverconfig.c the command "hiawatha -k" complains about the "ShowIndex" directive. It's not important for me, only a hint.

Karsten
Hugo Leisink
20 September 2011, 13:31
Can you tell me what the complaint is and what the ShowIndex option Hiawatha complaints about looks like?
Karsten
20 September 2011, 17:54
Blame me, I built Hiawatha with "--disable-xslt". I think "ShowIndex" is part of this module.
Hugo Leisink
20 September 2011, 17:59
Yes, the directory listing is build via XSLT: the index.xslt in the Hiawatha configuration directory.
Karsten
20 September 2011, 20:06
I understand, thanks again.

Karsten
This topic has been closed.