Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
146 lines (111 sloc) 4.65 KB
== link:index.html[Index] -> link:cookbook.html[Cookbook]
Cookbook: Setting up Nagios
Nagios is a host, service and network monitoring program. It is very
extended and can be up and running in 15 minutes just by following the
Guide]. Though it is well documented and is easy to follow, it is
intended for an Apache audience.
After following the quickstart instructions, getting Nagios it to work
with Cherokee is really simple.
Trivial set up: Cherokee as proxy
The most elemental set up is one that assumes that a Nagios
installation runs on another box and that Cherokee simply sits as a
reverse proxy between the Nagios-instance and the world.
In such a set up, we would have Nagios running in its own box with
Apache2, as detailed by their quick installation guide. The only
relevant parts of the apache-configuration are the ones defining the
actual paths. In our case:
ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
ScriptAlias /nagios3/cgi-bin /usr/lib/cgi-bin/nagios3
Alias /nagios3 /usr/share/nagios3/htdocs
The only needed configuration on the box running Cherokee would be
setting up a rule that matched the above listed paths, and proxied the
request to the server running Nagios.
As you can see, this is trivial to do. Assuming the Cherokee server
was and the Nagios box was, we would have to
follow these steps:
- First, define an information source with the parameters of
the Nagios box.
|Nick |Type |Host
|Nagios |External |
- Then, create the set of rules that match the following list of
. /cgi-bin/nagios3
. /nagios3/cgi-bin
. /nagios3
This, in turn, can be done easily. For compactness sake, we will just
use one but you could define a separate one if you need more precise
matching. The mechanism is exactly the same:
- Within the `Behavior` tab of your virtual server, choose "Regular
Expression" as type of the new rule, and use the expression
`.*nagios3.*` for it.
- In the `Handler` section, select the `HTTP reverse proxy` and assign
the information source previously defined.
Now, whenever a request to contains the `nagios3` substring,
it will be proxied to
Advanced set up: Cherokee as host
This is and advanced method only namely. In reality, it is exactly as
In this case, the relevant information from the configuration
file is limited to a couple of snippets:
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Alias /nagios "/usr/local/nagios/share"
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Please note the above paths are the ones used in the
Quickstart guide]. The paths are bound to change if you used any
prepackaged release.
We will translate these directly into a pair of directory-type rules.
The first one will match the `/nagios/cgi-bin` directory, and will be
handled by the `CGI` handler. We will map the `/usr/local/nagios/sbin`
as the `Web Directory` for the rule, in the `Rule` tab.
.First rule
.First rule
|Field | Value
|Handler | CGI
|Document root | /usr/local/nagios/sbin
The second one will do something similar, only mapping `/nagios` to
.Second rule
.Second rule
|Field | Value
|Handler | List & Send
|Document root | /usr/local/nagios/share
Finally, you can set up the authentication mechanism on both rules by
configuring the `Security` tab. Choose the `Htpasswd file` validation
mechanism, write the correct Password File (the one you should have
created during Nagios' installation), and input the mandatory realm
string, `Nagios` for instance. Note that this step is optional, since
you can secure your application with any other validation mechanism
provided by Cherokee.
.Security configuration
And that was all for today.
.Nagios in action
image::media/images/cookbook_nagios4.png[It's alive!]
Something went wrong with that request. Please try again.