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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Installing Nagios</title>
<STYLE type="text/css">
<!--
.Default { font-family: verdana,arial,serif; font-size: 8pt; }
.PageTitle { font-family: verdana,arial,serif; font-size: 12pt; font-weight: bold; }
-->
</STYLE>
</head>
<body bgcolor="#FFFFFF" text="black" class="Default">
<p>
<div align="center">
<h2 class="PageTitle">Installing Nagios</h2>
</div>
</p>
<hr>
<p>
<strong><font color='red'>Important:</font></strong> Installing and configuring Nagios is rather involved. You can't just compile the binaries, run the program and sit back. There's a lot to setup before you can actually start monitoring anything. Relax, take your time and read all the documentation - you're going to need it. Okay, let's get started...
</p>
<p>
<strong><u>Become Root</u></strong>
</p>
<p>
You'll need to have root access to install Nagios as described in this documentation, as you'll be creating users and group, modifying your web server config files, etc. Either login as root before you begin or use the <i>su</i> command to change to the root user from another account.
</p>
<p>
<strong><u>Getting The Latest Version</u></strong>
</p>
<p>
You can download the latest version of Nagios from <a href="http://www.nagios.org/download">http://www.nagios.org/download</a>.
</p>
<p>
<strong><u>Unpacking The Distribution</u></strong>
</p>
<p>
To unpack the Nagios distribution, use the following command:
</p>
<p>
<strong>
<font color="red">
tar xzf nagios-<i>version</i>.tar.gz
</font>
</strong>
</p>
<p>
When you have finished executing these commands, you should find a <b>nagios-<i>version</i></b> directory
that has been created in your current directory. Inside that directory you will find all the files
that comprise the core Nagios distribution.
</p>
<p>
<strong><u>Create Nagios User/Group</u></strong>
</p>
<p>
You're probably going to want to run Nagios under a normal user account, so add a new user (and group) to your system with the following command (this will vary depending on what OS you're running):
</p>
<p>
<strong>
<font color="red">
adduser nagios
</font>
</strong>
</p>
<p>
<strong><u>Create Installation Directory</u></strong>
</p>
<p>
Create the base directory where you would like to install Nagios as follows...
</p>
<p>
<p>
<strong>
<font color="red">
mkdir /usr/local/nagios
</font>
</strong>
</p>
<p>
Change the owner of the base installtion directory to be the Nagios user and group you added earlier as follows:
</p>
<p>
<strong>
<font color="red">
chown nagios.nagios /usr/local/nagios
</font>
</strong>
</p>
<p>
<strong><u>Identify Web Server User</u></strong>
</p>
<p>
You're probably going to want to issue <a href="extcommands.html">external commands</a> (like acknowledgements and scheduled downtime) from the web interface. To do so, you need to identify the user your web server runs as (typically <i>apache</i>, although this may differ on your system). This setting is found in your web server configuration file. The following command can be used to quickly determine what user Apache is running as (paths may differ on your system):
</p>
<p>
<strong>
<font color="red">
grep "^User" /etc/httpd/conf/httpd.conf<br>
</font>
</strong>
</p>
<p>
<strong><u>Add Command File Group</u></strong>
</p>
<p>
Next we're going to create a new group whose members include the user your web server is running as and the user Nagios is running as. Let's say we call this new group '<b>nagcmd</b>' (you can name it differently if you wish). On RedHat Linux you can use the following command to add a new group (other systems may differ):
</p>
<p>
<font color="red">/usr/sbin/groupadd nagcmd</font>
</p>
<p>
Next, add the users that your web server and Nagios run as to the newly created group with the following commands (I'll assume <i>apache</i> and <i>nagios</i> are the respective users):
</p>
<p>
<font color="red">/usr/sbin/usermod -G nagcmd apache</font><br>
<font color="red">/usr/sbin/usermod -G nagcmd nagios</font><br>
</p>
<p>
<strong><u>Run the Configure Script</u></strong>
</p>
<p>
Run the configure script to initialize variables and create a Makefile as follows...(the last two options: --with-command-<i>xxx</i> are optional, but needed if you want to issue <a href="extcommands.html">external commands</a>)
</p>
<p>
<strong>
<font color="red">
./configure --prefix=<i>prefix</i> --with-cgiurl=<i>cgiurl</i> --with-htmurl=<i>htmurl</i> --with-nagios-user=<i>someuser</i> --with-nagios-group=<i>somegroup</i> --with-command-group=<i>cmdgroup</i>
</font>
</strong>
</p>
<p>
<ul>
<li>Replace <i>prefix</i> with the installation directory that you created in the step above (default is <i>/usr/local/nagios</i>)
<li>Replace <i>cgiurl</i> with the actual url you will be using to access the <a href="cgis.html">CGIs</a> (default is <i>/nagios/cgi-bin</i>). Do NOT append a slash at the end of the url.
<li>Replace <i>htmurl</i> with the actual url you will be using to access the HTML for the main interface and documentation (default is <i>/nagios/</i>)
<li>Replace <i>someuser</i> with the name of a user on your system that will be used for setting permissions on the installed files (default is <i>nagios</i>)
<li>Replace <i>somegroup</i> with the name of a group on your system that will be used for setting permissions on the installed files (default is <i>nagios</i>)
<li>Replace <i>cmdgroup</i> with the name of the group running the web server (default is <i>nagios</i>, in the example above it was <i>nagcmd</i>). This will allow group members (i.e. your web server) to be able to submit external commands to Nagios.
</ul>
</i>
</p>
<p>
<strong><u>Compile Binaries</u></strong>
</p>
<p>
Compile Nagios and the CGIs with the following command:
</p>
<p>
<strong>
<font color="red">
make all
</font>
</strong>
</p>
<p>
<a name="installing"></a>
<strong><u>Installing The Binaries And HTML Files</u></strong>
</p>
<p>
Install the binaries and HTML files (documentation and main web page) with the following command:
</p>
<p>
<strong>
<font color="red">
make install
</font>
</strong>
</p>
<p>
<strong><u>Installing An Init Script</u></strong>
</p>
<p>
If you wish, you can also install the sample init script to <i>/etc/rc.d/init.d/nagios</i> with the following command:
</p>
<p>
<strong>
<font color="red">
make install-init
</font>
</strong>
</p>
<p>
You may have to edit the init script to make sense with your particular OS and Nagios installation by editing paths, etc.
</p>
<p>
<a name="files"></a>
<strong><u>Directory Structure And File Locations</u></strong>
</p>
<p>
Change to the root of your Nagios installation directory with the following command...
</p>
<p>
<strong>
<font color="red">
cd /usr/local/nagios
</font>
</strong>
</p>
<p>
You should see five different subdirectories. A brief description of what each directory contains is given in the table below.
</p>
<p>
<table border="1" class="Default">
<tr>
<td bgcolor="#cbcbcb"><strong>Sub-Directory</strong></td>
<td bgcolor="#cbcbcb"><strong>Contents</strong></td>
</tr>
<tr>
<td><strong>bin/</strong></td>
<td>Nagios core program</td>
</tr>
<tr>
<td><strong>etc/</strong></td>
<td><a href="configmain.html">Main</a>, <a href="configmain.html#resource_file">resource</a>, <a href="configobject.html">object</a>, and <a href="configcgi.html">CGI</a> configuration files should be put here</td>
</tr>
<tr>
<td><strong>sbin/</strong></td>
<td><a href="cgis.html">CGIs</a></td>
</tr>
<tr>
<td><strong>share/</strong></td>
<td>HTML files (for web interface and online documentation)</td>
</tr>
<tr>
<td><strong>var/</strong></td>
<td>Empty directory for the <a href="configmain.html#log_file">log file</a>, <a href="configmain.html#status_file">status file</a>, <a href="configmain.html#state_retention_file">retention file</a>, etc.</td>
</tr>
<tr>
<td><strong>var/archives</strong></td>
<td>Empty directory for the <a href="configmain.html#log_archive_path">archived logs</a></td>
</tr>
<tr>
<td><strong>var/rw</strong></td>
<td>Empty directory for the <a href="configmain.html#command_file">external command file</a></td>
</tr>
</table>
</p>
<p>
<strong><u>Installing The Plugins</u></strong>
</p>
<p>
In order for Nagios to be of any use to you, you're going to have to download and install some <a href="plugins.html">plugins</a>. Plugins are usually installed in the <b>libexec/</b> directory of your Nagios installation (i.e. <i>/usr/local/nagios/libexec</i>). Plugins are scripts or binaries which perform all the service and host checks that constitute monitoring. You can grab the latest release of the plugins from the <a href="http://www.nagios.org/download">Nagios downloads page</a> or directly from the <a href="http://sourceforge.net/projects/nagiosplug/">SourceForge project page</a>.
</p>
<p>
<strong><u>Setup The Web Interface</u></strong>
</p>
<p>
You're probably going to want to use the web interface, so you'll also have to read the instructions on <a href="installweb.html">setting up the web interface</a> and configuring web authentication, etc. next.
</p>
<p>
<strong><u>Configuring Nagios</u></strong>
</p>
<p>
So now you have things compiled and installed, but you still haven't configured Nagios or defined objects (hosts, services, etc.) that should be monitored. Information on configuring Nagios and defining objects can be found <a href="config.html">here</a>. There's a lot to configure, but don't let it discourage you - its well worth it.
</p>
<hr>
</body>
</html>
|