2. Installing and configuring the Nagios monitoring System
2.1 Creating Nagios Users and Groups
#useradd-S/usr/sbin/nologin nagios#### Specify user default shell does not have permission to log on user
#mkdir/usr/local/nagios#### Nagios Main program installation directory
#chown-R Nagios.nagios/usr/local/nagios # # # # # # set Genus Main group
2.2 Opening the system SendMail
The primary role of opening the SendMail service on the Nagios monitoring Server allows Nagios to send alarm messages when a failure is detected. Linux comes with SendMail service. On. No configuration is required.
2.3 Compiling and installing Nagios
#tar-ZXVF nagios-3.2.0.tar.gz#### Extract Source Package
#cd nagios-3.2.0#### into the package directory
#./config--prefix=/usr/local/nagios#### specifying the Nagios installation directory
#make all#### Compile all source code in the current directory
#make install#### Install the Nagios main program. Ggi and HTML files
#make install-init#### Maintenance Nagios scripts into the/ETC/RE.D/INIT.D directory
#make install-cimmandmode#### Configure permissions Directory
Install the Nagios configuration file #make install-config####. Here the installation path is/USR/LOCAL/NAGIOS/ETC
After you finish the operation. Indicates that the installation is complete "Note the installation is dependent on the package"
The following table explains the directory name:
Binnagios the directory where the executable program resides
directory where the Etcnagios configuration is located
The directory where the Sbinnagios CGI file resides. That is, the directory where the files required to execute the external command reside
Sharenagios the directory where the Web page file resides
Libexec Nagios External plug-in directory
Varnagios the directory where files such as log files \lock
Var/archivesnagios Log Auto Archive directory
VAR/RW the directory used to store external command files
2.4 Installing the Nagios plugin
Note: The plugin version is not associated with the Nagios version
#tar-zxvfnagios-plugins-1.4.14.tar.gz
#cd nagios-plugins-1.4.14
#./configure--prefix=/usr/local/nagios### Specify the Nagios installation directory here
#make
#make Install
The installation is complete. Under/usr/local/nagios under the Libexec directory. Generate many executables. These are the plugins that Nagios needs.
2.5 Installing the Nagios culture plugin
Note: Download the corresponding version [must. Because the association is large]
#tar-XVFZ nagios-cn-3.2.0.tar.bz
#cd nagios-cn-3.2.0
#./configure### the installation directory for Nagios is found by default. If the Nagios installation directory is not specified under/usr/local/
#make All
#make Install
2.6 Installing and configuring Apache and PHP
Apache installation of a Web service is necessary
Nagios requires PHP support when configuring the Web monitoring interface after the 3.1.X version. Here we download the Nagios version of nagios-3.2.0, so after the completion of the installation of Apache, we also need to compile the PHP module, the PHP version selected here is php5.3.2
(1) Installing Apache and PHP
To install Apache first, proceed as follows:
# tar ZXVF httpd-2.0.63.tar.gz
#cd httpd-2.0.63
#./configure--prefix=/usr/local/apache2
#make
#make Install
(2) then install PHP, the steps are as follows:
# tar ZXVF php-5.3.2.tar.gz
#cd php-5.3.2
#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs
#make
#make Install
From the installation steps, the Apache installation path is/usr/local/apache2, and the PHP installation path is/usr/local/php.
Configuration:
Locate the Apache configuration file/usr/local/apache2/conf/httpd.conf "Note: You can back up the profile first"
Found it:
User Nobody
Group #-1
Revision changed to
User Nagios
Group Nagios
And then find
DirectoryIndex index.html Index.html.var
Revision changed to
DirectoryIndex index.html index.php
The following additions are then added:
AddType application/x-httpd-php. php
Add the following information at the end of the configuration file:
#setting for Nagios
Scriptalias/nagios/cgi-bin "/usr/local/nagios/sbin"
<directory "/usr/local/nagios/sbin" >
AuthType Basic
Options execcgi
AllowOverride None
Order Allow,deny
Allow from all
AuthName "Nagios Access"
authuserfile/usr/local/nagios/etc/htpasswd
Require Valid-user
</Directory>
Alias/nagios "/usr/local/nagios/share"
<directory "/usr/local/nagios/share" >
AuthType Basic
Options None
AllowOverride None
Order Allow,deny
Allow from all
AuthName "Nagios Access"
authuserfile/usr/local/nagios/etc/htpasswd
Require Valid-user
</Directory>
(3) Create Apache directory validation files
In the above configuration, the directory validation file htpasswd is specified, and the following is the file to be created:
#/usr/local/apache2/bin/htpasswd-c/usr/local/nagios/etc/htpasswd IXDBA
New Password: (Enter password)
Re-type New Password: (Enter password again)
Adding Password for user ixdba
This creates a HTPASSWD authentication file in the/usr/local/nagios/etc directory, which is required to enter the user name and password when accessed through http://ip/nagios/.
Finally, start the service:
#/usr/local/apache2/bin/apachectl start
(4) Nagios default configuration file Introduction
The update is not yet complete. Continuous updates ...
Nagios_ Installation and Configuration