Introduction to the outset
Recently due to work needs, learning to study the installation, configuration, use of Nagios, about Nagios introduction, you can refer to my previous essay Nagios Learning Practice Series-Product introduction
Experimental environment
Operating system: Red Hat Enterprise Linux Server Release 6.0 (Santiago).
Note that Nagios can only be installed on Linux or UNIX platforms, does not support the Windows platform, and of course it can monitor the Windows platform.
Environment preparation
Apache and PHP are not required to install Nagios, in fact, it is necessary, you can not analyze the Nagios log bar, because Nagios provides a web monitoring interface, through the Web monitoring interface can clearly see the monitoring of the host, services, resources running state, therefore, It is necessary to install a Web service environment. Details on the installation configuration of Apache and PHP can be found in my essay: Linux system Installation Appach 2.4.6 and Redhat Server 5.7 installation configuration PHP, there will not be too much detail to introduce.
One: Installation APACHE
First check whether to install GCC, gcc-c++ package, because we are under the source code compiled to install Apache software.
1 : APR and Apr-util Package Installation
[Email protected] nagios]# tar zxvf apr-1.4.8.tar.gz
[Email protected] nagios]# CD apr-1.4.8
[Email protected] apr-1.4.8]# MKDIR/USR/LOCAL/APR
[Email protected] apr-1.4.8]#/configure--PREFIX=/USR/LOCAL/APR
[[email protected] apr-1.4.8]# make & make Install
Verify that the APR package is installed successfully, and if you can see four directories such as bin, build-1, etc. in the installation directory, you have successfully installed the APR package.
[Email protected] nagios]# Mkdir/usr/local/apr-util
[Email protected] nagios]# tar xzvf apr-util-1.5.2.tar.gz
[Email protected] apr-util-1.5.2]# CD apr-util-1.5.2
[Email protected] apr-util-1.5.2]#/configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/ Apr-1-config
[[email protected] apr-util-1.5.2]# make && make install
Verify that the Apr-util package is installed successfully, and if you can see the bin, include, and Lib three directories in the installation directory, you have successfully installed the APR package.
2:pcre Package Installation
[Email protected] nagios]# Unzip Pcre-8.33.zip
[Email protected] nagios]# CD pcre-8.33
[Email protected] pcre-8.33]# Mkdir/usr/local/pcre
[Email protected] pcre-8.33]#/configure--prefix=/usr/local/pcre--with-apr=/usr/local/apr/bin/apr-1-config
[[email protected] pcre-8.33]# make && make install
3:apache HTTP Server Installation
[Email protected] nagios]# tar xzvf httpd-2.4.6.tar.gz
[Email protected] nagios]# CD httpd-2.4.6
[Email protected] httpd-2.4.6]# Mkdir/usr/local/apache
[Email protected] httpd-2.4.6]#/configure--prefix=/usr/local/apache/--with-pcre=/usr/local/pcre/--with-apr=/ USR/LOCAL/APR--with-apr-util=/usr/local/apr-util
[[email protected] httpd-2.4.6] #make && make install
Configure httpd.conf, locate the servername option, and add the server IP address below, as shown below
[Email protected] conf]# cd/usr/local/apache/conf
[[email protected] conf]# ls
Extra httpd.conf Magic Mime.types Original
[Email protected] conf]# VI httpd.conf
Launch Apache service, verify the installation is successful, if you enter http://localhost/in the browser display "It works!", that means that Apache has been installed successfully
[[email protected] conf]#/usr/local/apache/bin/apachectl start
HTTPD (PID 11025) already running
Two: Install PHP
[Email protected] nagios]# tar zxvf php-5.3.26.tar.gz
[Email protected] nagios]# CD php-5.3.26
[Email protected] nagios]#/configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs
The error occurred during configuration, because of the missing Libxml2-devel package, the Libxml2-devel package needs to be installed first
[email protected] php-5.3.26]# Yum install Libxml2-devel
[Email protected] nagios]#/configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs
[[email protected] nagios]# make
[[email protected] nagios]# make test
[[email protected] nagios]# make install
[Email protected] conf]# cd/usr/local/apache/conf
Under the/usr/local/apache/conf directory, configure the httpd.conf file to add index.php
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
Next find <ifmodule mime_module> Add configuration information AddType application/x-httpd-php. PHP, other configurations, etc. install the Nagios-related package for configuration.
Nagios Installation
STEP1: Check if the package is installed because Nagios needs to rely on these packages to provide services
[Email protected] nagios]# rpm-q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
[[email protected] Nagios] #yum install-y gd gd-devel xinetd openssl-devel
Because I have no gd-devel under the mirror, if you do not install the package, you will encounter some problems later, this package must be installed.
Step 2: Build Nagios Account
[Email protected] ~]# Useradd Nagios
[Email protected] ~]# Mkdir/usr/local/nagios
[Email protected] ~]# chown-r nagios.nagios/usr/local/nagios/
[Email protected] ~]#
Step 3: Download Nagios related packages
Nagios Core
Nagios Core, as its name implies, is a core part of the Nagios system, with a core monitoring engine and a basic web interface.
Http://www.nagios.org/download/core, currently the latest version is 4.0.0 beta1, generally we download a stable version of Nagios core 3.5.0.
Nagios Plugins
Nagios Plugins is a Nagios plug-in package that monitors services, applications, metrics, and so on. Like NRPE, nsclient++ , etc., you can download a variety of plugins via the link address below http://www.nagios.org/download/plugins/.
Nagios Frontends
Nagios Frontends is the skin of nagios (front end? ), you can get some more personalized, beautiful web monitoring interface
Nagios Addons
Nagios Addons is the Nagios extension project, http://www.nagios.org/download/addons/
Step 4: Install Nagios Core
Unzip the installation file
[Email protected] nagios]# tar zxvf nagios-3.5.0.tar.gz
[[Email protected] nagios]# CD Nagios
Compiling the installation package
[Email protected] nagios]#/configure--prefix=/usr/local/nagios/
[[email protected] nagios]# make all
[[email protected] nagios]# make install
[email protected] nagios]# make Install-init
[email protected] nagios]# make Install-commandmode
[email protected] nagios]# make Install-config
[email protected] nagios]# make install-webconf
Verify that the installation is successful
Step 5: Install the Nagios plugin
[Email protected] nagios]# tar zxvf nagios-plugins-1.4.16.tar.gz
[Email protected] nagios]# CD nagios-plugins-1.4.16
[Email protected] nagios-plugins-1.4.16]#/configure--prefix=/usr/local/nagios
[[email protected] Nagios] #make && make install
Step 6:apache Basic Configuration
[Email protected] nagios-plugins-1.4.16]# cd/usr/local/apache/conf/
[Email protected] conf]# VI httpd.conf
Step 7: Start related services
7.1 Launching the Apache service
[[email protected] conf]#/usr/local/apache/bin/apachectl start
7.2 Starting the Nagios service
[[Email protected] conf]# service Nagios start
Http://192.168.210.129/nagios/will be able to enter.
Nagios Learning Practice Series-Basic installation articles