/usr/share/doc/cherokee-doc/cookbook_nagios.html is in cherokee-doc 1.2.101-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="ROBOTS" content="ALL" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="Keywords" content="cherokee web server httpd http" />
<meta name="Description" content="Cherokee is a flexible, very fast, lightweight Web server. It is implemented entirely in C, and has no dependencies beyond a standard C library. It is embeddable and extensible with plug-ins. It supports on-the-fly configuration by reading files or strings, TLS/SSL (via GNUTLS or OpenSSL), virtual hosts, authentication, cache friendly features, PHP, custom error management, and much more." />
<link href="media/css/cherokee_doc.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<h2 id="_a_href_index_html_index_a_8594_a_href_cookbook_html_cookbook_a"><a href="index.html">Index</a> → <a href="cookbook.html">Cookbook</a></h2>
<div class="sectionbody">
</div>
<h2 id="_cookbook_setting_up_nagios">Cookbook: Setting up Nagios</h2>
<div class="sectionbody">
<div class="paragraph"><p>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
<a href="http://nagios.sourceforge.net/docs/3_0/quickstart.html">Quickstart
Guide</a>. Though it is well documented and is easy to follow, it is
intended for an Apache audience.</p></div>
<div class="paragraph"><p>After following the quickstart instructions, getting Nagios it to work
with Cherokee is really simple.</p></div>
<h3 id="trivial">Trivial set up: Cherokee as proxy</h3><div style="clear:left"></div>
<div class="paragraph"><p>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.</p></div>
<div class="paragraph"><p>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:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
ScriptAlias /nagios3/cgi-bin /usr/lib/cgi-bin/nagios3
Alias /nagios3 /usr/share/nagios3/htdocs</tt></pre>
</div></div>
<div class="paragraph"><p>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.</p></div>
<div class="paragraph"><p>As you can see, this is trivial to do. Assuming the Cherokee server
was 10.0.0.10 and the Nagios box was 10.0.0.11, we would have to
follow these steps:</p></div>
<div class="ulist"><ul>
<li>
<p>
First, define an information source with the parameters of
the Nagios box.
</p>
<div class="tableblock">
<table rules="all"
width="100%"
frame="border"
cellspacing="0" cellpadding="4">
<col width="33%" />
<col width="33%" />
<col width="33%" />
<thead>
<tr>
<th align="left" valign="top">Nick </th>
<th align="left" valign="top">Type </th>
<th align="left" valign="top">Host</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p class="table">Nagios</p></td>
<td align="left" valign="top"><p class="table">External</p></td>
<td align="left" valign="top"><p class="table">10.0.0.11:80</p></td>
</tr>
</tbody>
</table>
</div>
</li>
<li>
<p>
Then, create the set of rules that match the following list of
paths:
</p>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
/cgi-bin/nagios3
</p>
</li>
<li>
<p>
/nagios3/cgi-bin
</p>
</li>
<li>
<p>
/nagios3
</p>
</li>
</ol></div>
</li>
</ul></div>
<div class="paragraph"><p>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:</p></div>
<div class="ulist"><ul>
<li>
<p>
Within the <tt>Behavior</tt> tab of your virtual server, choose "Regular
Expression" as type of the new rule, and use the expression
<tt>.*nagios3.*</tt> for it.
</p>
</li>
<li>
<p>
In the <tt>Handler</tt> section, select the <tt>HTTP reverse proxy</tt> and assign
the information source previously defined.
</p>
</li>
</ul></div>
<div class="paragraph"><p>Now, whenever a request to 10.0.0.10 contains the <tt>nagios3</tt> substring,
it will be proxied to 10.0.0.11.</p></div>
<h3 id="advanced">Advanced set up: Cherokee as host</h3><div style="clear:left"></div>
<div class="paragraph"><p>This is and advanced method only namely. In reality, it is exactly as
simple.</p></div>
<div class="paragraph"><p>In this case, the relevant information from the configuration
file is limited to a couple of snippets:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
AuthUserFile /usr/local/nagios/etc/htpasswd.users</tt></pre>
</div></div>
<div class="paragraph"><p>and</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>Alias /nagios "/usr/local/nagios/share"
AuthUserFile /usr/local/nagios/etc/htpasswd.users</tt></pre>
</div></div>
<div class="paragraph"><p>Please note the above paths are the ones used in the
<a href="http://nagios.sourceforge.net/docs/3_0/quickstart.html">Nagios
Quickstart guide</a>. The paths are bound to change if you used any
prepackaged release.</p></div>
<div class="paragraph"><p>We will translate these directly into a pair of directory-type rules.</p></div>
<div class="paragraph"><p>The first one will match the <tt>/nagios/cgi-bin</tt> directory, and will be
handled by the <tt>CGI</tt> handler. We will map the <tt>/usr/local/nagios/sbin</tt>
as the <tt>Web Directory</tt> for the rule, in the <tt>Rule</tt> tab.</p></div>
<div class="imageblock">
<div class="content">
<img src="media/images/cookbook_nagios1.png" alt="media/images/cookbook_nagios1.png" />
</div>
<div class="image-title">First rule</div>
</div>
<div class="tableblock">
<table rules="all"
width="100%"
frame="border"
cellspacing="0" cellpadding="4">
<caption class="title">First rule</caption>
<col width="50%" />
<col width="50%" />
<thead>
<tr>
<th align="left" valign="top">Field </th>
<th align="left" valign="top"> Value</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p class="table">Handler</p></td>
<td align="left" valign="top"><p class="table">CGI</p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table">Document root</p></td>
<td align="left" valign="top"><p class="table">/usr/local/nagios/sbin</p></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph"><p>The second one will do something similar, only mapping <tt>/nagios</tt> to
<tt>/usr/local/nagios/share</tt>.</p></div>
<div class="imageblock">
<div class="content">
<img src="media/images/cookbook_nagios2.png" alt="media/images/cookbook_nagios2.png" />
</div>
<div class="image-title">Second rule</div>
</div>
<div class="tableblock">
<table rules="all"
width="100%"
frame="border"
cellspacing="0" cellpadding="4">
<caption class="title">Second rule</caption>
<col width="50%" />
<col width="50%" />
<thead>
<tr>
<th align="left" valign="top">Field </th>
<th align="left" valign="top"> Value</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p class="table">Handler</p></td>
<td align="left" valign="top"><p class="table">List & Send</p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table">Document root</p></td>
<td align="left" valign="top"><p class="table">/usr/local/nagios/share</p></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph"><p>Finally, you can set up the authentication mechanism on both rules by
configuring the ‘Security` tab. Choose the <tt>Htpasswd file</tt> validation
mechanism, write the correct Password File (the one you should have
created during Nagios’ installation), and input the mandatory realm
string, <tt>Nagios</tt> for instance. Note that this step is optional, since
you can secure your application with any other validation mechanism
provided by Cherokee.</p></div>
<div class="imageblock">
<div class="content">
<img src="media/images/cookbook_nagios3.png" alt="media/images/cookbook_nagios3.png" />
</div>
<div class="image-title">Security configuration</div>
</div>
<div class="paragraph"><p>And that was all for today.</p></div>
<div class="imageblock">
<div class="content">
<img src="media/images/cookbook_nagios4.png" alt="media/images/cookbook_nagios4.png" />
</div>
<div class="image-title">Nagios in action</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
</div>
</div>
</body>
</html>
|