Operation and Maintenance Monitoring Tool Nagios: Installing Nagios

Source: Internet
Author: User

First, pre-installation preparation

(1) Creating Nagios users and user groups
[[Email protected] ~] #useradd-S/sbin/nologin nagios
[[Email protected] ~] #mkdir/usr/local/nagios
[[Email protected] ~] #chown –R Nagios.nagios/usr/local/nagios
(2) Open System SendMail Service
The primary role of the SendMail service on the Nagios monitoring server is to allow Nagios to send alert messages when a failure is detected, and now almost all Linux distributions have their own sendmail service, so When installing the system, you only need to turn on the SendMail service and do not require any configuration on the sendmail.

Ii. Compiling and installing Nagios
[Email protected] ~]# TAR-ZXVF nagios-3.2.0.tar.gz
[Email protected] ~]# CD nagios-3.2.0
[Email protected] nagios-3.2.0]#./configure--prefix=/usr/local/nagios
#指定nagios的安装目录, specify the Nagios installation to the/usr/local/nagios directory here
[[email protected] nagios-3.2.0] #make all
[[email protected] nagios-3.2.0] #make Install
# make install for Nagios's main program, CGI and HTML files
[email protected] nagios-3.2.0]# make Install-init
#通过make install-init command to create Nagios startup scripts in the/ETC/RC.D/INIT.D directory
[email protected] nagios-3.2.0]# make Install-commandmode
#通过make install-commandmode command to configure directory permissions
[email protected] nagios-3.2.0]# make Install-config
#make install-cofig command to install the Nagios sample configuration file, the path installed here is/USR/LOCAL/NAGIOS/ETC

3. Nagios Directory Introduction

After Nagios installation is complete, the directory structure and function descriptions are shown in the following table: operation and Maintenance monitoring Tool Nagios: Installing Nagios


4,   install Nagios plugin

  Download the version here is nagios-plugins-1.4.14.
  Note: The plugin version is not associated with the Nagios version.
[[email protected] nagios] #tar –zxvf  nagios-plugins-1.4.14.tar.gz< BR style= "padding:0px; margin:0px ">[[email protected] nagios] #cd   NAGIOS-PLUGINS-1.4.14
[[ Email protected] Nagios-plugins-1.4.14]#./configure--prefix=/usr/local/nagios
[[email protected] nagios-plugins-1.4.14]# make 
[[email protected" nagios-plugins-1.4.14]# make install
  Installation is complete, under the Libexec directory under/usr/local/nagios, generate a lot of executables, these are the plugins required by Nagios.

5. Install the culture plugin in Nagios
Chinese plugin:
http://sourceforge.net/projects/nagios-cn/files/
Download the Chinese plugin for the Nagios version and start the installation:
[[Email protected] ~] #tar XVFZ nagios-cn-3.2.0.tar.bz2
[[email protected] nagios-cn-3.2.0] #cd nagios-cn-3.2.0
[Email protected] Nagios-cn-3.2.0]#./configure
[[email protected] nagios-cn-3.2.0] #make all
[[email protected] nagios-cn-3.2.0] #make Install


6. Install and configure Apache and PHP
Apache and PHP are not required to install Nagios, but Nagios provides a web monitoring interface that clearly sees the running state of monitored hosts and resources through the Web monitoring interface, so it is necessary to install a Web service.
It is important to note that Nagios requires PHP support when configuring the Web monitoring interface after the nagios3.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:
[Email protected] ~]# tar zxvf httpd-2.0.63.tar.gz
[[Email protected] ~] #cd httpd-2.0.63
[Email protected] ~]#./configure--prefix=/usr/local/apache2
[[Email protected] ~] #make
[[Email protected] ~] #make Install
Then install PHP with the following steps:
[Email protected] ~]# tar zxvf php-5.3.2.tar.gz
[[Email protected] ~] #cd php-5.3.2
[Email protected] ~]#./configure--prefix=/usr/local/php \
>--with-apxs2=/usr/local/apache2/bin/apxs
[[Email protected] ~] #make
[[Email protected] ~] #make Install
From the installation steps, the Apache installation path is/usr/local/apache2, and the PHP installation path is/usr/local/php.

(2) Configure APACHE
find Apache configuration file/usr/local/apache2/conf/ HTTPD.CONF&NBSP;
found:
User nobody
group #-1
modified to
User nagios
group nagios
then find
revision changed to
directoryindex index.html index.php
addtype application/x-httpd-php. PHP

For the sake of security, in general the Nagios Web monitoring interface must be authorized for access, which requires an additional authentication configuration, i.e. the following information is added at the end of the httpd.conf 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:
[email protected] nagios]#/usr/local/apache2/bin/htpasswd \
&GT;-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:
[[email protected] nagiosserver ~]#/usr/local/apache2/bin/apachectl start

Operation and Maintenance Monitoring Tool Nagios: Installing Nagios

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.