O & M monitoring tool Nagios: Install nagios and nagios

Source: Internet
Author: User

O & M monitoring tool Nagios: Install nagios and nagios

I. Preparations before installation

(1) Create nagios users and user groups
[Root @ localhost ~] # Useradd-s/sbin/nologin nagios
[Root @ localhost ~] # Mkdir/usr/local/nagios
[Root @ localhost ~] # Chown-R nagios. nagios/usr/local/nagios
(2) Enable the sendmail service.
The main function of enabling the sendmail service on the nagios monitoring server is to enable nagios to send an alarm email when detecting a fault. Currently, almost all linux releases have their own sendmail service by default, when installing the system, you only need to enable the sendmail service without any configuration on sendmail.

2. Compile and install Nagios
[Root @ localhost ~] # Tar-zxvf nagios-3.2.0.tar.gz
[Root @ localhost ~] # Cd nagios-3.2.0
[Root @ localhost nagios-3.2.0] #./configure -- prefix =/usr/local/nagios
# Specify the nagios installation directory. Here, specify nagios installation to the/usr/local/nagios directory.
[Root @ localhost nagios-3.2.0] # make all
[Root @ localhost nagios-3.2.0] # make install
# Make install is used to install the main program of nagios, CGI and HTML files
[Root @ localhost nagios-3.2.0] # make install-init
# Run the make install-init command to create a nagios STARTUP script in the/etc/rc. d/init. d directory.
[Root @ localhost nagios-3.2.0] # make install-commandmode
# Use the make install-commandmode command to configure Directory Permissions
[Root @ localhost nagios-3.2.0] # make install-config
# Make install-cofig command is used to install the nagios sample configuration file. The installation path is/usr/local/nagios/etc.

3. Nagios directory Introduction

After Nagios is installed, the following table describes the directory structure and functions:Nagios: Installing nagios


4. Install the Nagios plugin

The version downloaded here is the nagios-plugins-1.4.14.
Note: The plug-in version is not associated with the nagios version.
[Root @ localhost nagios] # tar-zxvf nagios-plugins-1.4.14.tar.gz
[Root @ localhost nagios] # nagios-plugins-1.4.14 cd
[Root @ localhost nagios-plugins-1.4.14] #./configure -- prefix =/usr/local/nagios
[Root @ localhost nagios-plugins-1.4.14] # make
[Root @ localhost nagios-plugins-1.4.14] # make install
After the installation is complete, many executable files are generated under the libexec directory under/usr/local/nagios, which are exactly the plug-ins required by nagios.

5. Install the Nagios INS
Chinese Plugin:
Http://sourceforge.net/projects/nagios-cn/files/
Download the Chinese plug-in of the corresponding nagios version and start the installation:
[Root @ localhost ~] # Tar xvfz nagios-cn-3.2.0.tar.bz2
[Root @ localhost nagios-cn-3.2.0] # cd nagios-cn-3.2.0
[Root @ localhost nagios-cn-3.2.0] #./configure
[Root @ localhost nagios-cn-3.2.0] # make all
[Root @ localhost nagios-cn-3.2.0] # make install


6. install and configure apache and php
Apache and php are not required to install nagios. However, nagios provides a web monitoring interface that clearly shows the running status of monitored hosts and resources. Therefore, it is necessary to install a web service.
Note that nagios Versions later than nagios3.1.x require php support When configuring the web monitoring interface. Here we download the nagios version for the nagios-3.2.0, so after compiling and installing apache, you also need to compile the php module, here the selected php version is php5.3.2.
(1) install apache and php
To install apache, follow these steps:
[Root @ nagiosserver ~] # Tar zxvf httpd-2.0.63.tar.gz
[Root @ nagiosserver ~] # Cd httpd-2.0.63
[Root @ nagiosserver ~] #./Configure -- prefix =/usr/local/apache2
[Root @ nagiosserver ~] # Make
[Root @ nagiosserver ~] # Make install
Install php as follows:
[Root @ nagiosserver ~] # Tar zxvf php-5.3.2.tar.gz
[Root @ nagiosserver ~] # Cd php-5.3.2
[Root @ nagiosserver ~] #./Configure -- prefix =/usr/local/php \
> -- With-apxs2 =/usr/local/apache2/bin/apxs
[Root @ nagiosserver ~] # Make
[Root @ nagiosserver ~] # Make install
According to the installation steps, the installation path of apache is/usr/local/apache2, and that of php is/usr/local/php.

(2) Configure apache
Find the apache configuration file/usr/local/apache2/conf/httpd. conf.
Find:
User nobody
Group #-1
Change
User nagios
Group nagios
Then find
DirectoryIndex index.html. var
Change
DirectoryIndex index.html index. php
Add the following content:
AddType application/x-httpd-php. php

To ensure security, the nagios web monitoring interface must be authorized for access. In this case, you need to add the verification configuration, that is, add the following information 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 an apache directory verification file
In the preceding configuration, the directory authentication file htpasswd is specified. Create this file as follows:
[Root @ localhost nagios] #/usr/local/apache2/bin/htpasswd \
>-C/usr/local/nagios/etc/htpasswd ixdba
New password: (enter the password)
Re-type new password: (enter the password again)
Adding password for user ixdba
In this way, an htpasswd authentication file is created under the/usr/local/nagios/etc directory. You need to enter the user name and password when accessing the file through http: // ip/nagios.
Finally, start the service:
[Root @ nagiosserver ~] #/Usr/local/apache2/bin/apachectl start


Software required for nagios monitoring

Nagios-plugin and nrpe plug-ins

What services does nagios monitor?

Leave an email. I will send it to you. Okay.

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.