Configuration method: source code compilation.
Reference:
Installation and configuration of Nagios under Linux
Installation and configuration of Nagios image Pnp4nagios
Slime: Learning Nagios (iv): Pnp4nagios graphically draw Nagios data
The above three articles are a great help to me in learning Nagios, and I would like to thank you for that.
So, let's start with our configuration.
--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------
First, the working environment
Operating system: CentOS 6
Please close the firewall with SELinux before configuring
Second, the configuration steps
2.1 Nagios server-side installation
Nagios Basic Support Kit GCC glibc glibc-common gd gd-devel xinetd openssl-devel
Use the command gcc glibc glibc-common gd gd-devel xinetd openssl-devel to see if the vehicle has the base kit installed, and if not, install the base kit with the following command
Yum install-y gcc glibc glibc-common gd gd-devel xinetd openssl-devel
Create Nagios users and user groups for non-logon mode, create Nagios directory, change directory owner to Nagios
# useradd-s/sbin/mkdir /usr/local/chown -R Nagios.nagios/usr/local/nagios
To compile and install Nagios, first enter the ~/download directory and execute the following command
#wgethttp//prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.3.tar.gz#TarZXVF nagios-3.4.3.Tar. gz# cd nagios#./configure--prefix=/usr/local/nagios# Makeall# Make Install# Make Install-init# Make Install-commandmode# Make Install-config
You can set the Nagios service as a system service
# chkconfig----list Nagios
Verify that the program is installed correctly:
Switch directories to the installation path (here is/usr/local/nagios) to see if there are five directories such as etc, bin, sbin, share, Var, if present, it can indicate that the program is properly installed to the system. Nagios Various directory uses are described below:
| Bin |
The directory where the Nagios executable program resides |
| etc |
The directory where the Nagios configuration files are located |
| Sbin |
The directory where the Nagios CGI files are located, that is, the files required to execute the external command |
| Share |
The directory where the Nagios Web page file resides |
| Libexec |
The directory where Nagios external plugins are located |
| Var |
The directory where Nagios log files, lock, and other files reside |
| Var/archives |
Nagios Log Auto Archive directory |
| Var/rw |
The directory used to store external command files |
Installing the Nagios plugin nagios-plugins-1.4.16
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/ nagios-plugins-1.4.16.tar.gztar zxvf nagios-plugins-1.4. . Tar . gz# cd Nagios-plugins-1.4. - # . /configure--prefix=/usr/local/make doinstall
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.4.3, so after the completion of the installation of Apache, we also need to compile the PHP module, the PHP version selected here is php5.5.38.
#wgethttp//archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz# TarZXVF httpd-2.2. at.Tar. gz# CD httpd-2.2. at# ./configure--prefix=/usr/local/apache2# Make&& Make Install# wgethttp//cn2.php.net/distributions/php-5.4.10.tar.gz# TarZXVF php-5.4.Ten.Tar. gz# cd PHP-5.4.Ten# ./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs# Make&& Make Install
Locate the Apache configuration file/usr/local/apache2/conf/httpd.conf
Found it:
Not to be continued ...
Linux system Administrator's automated detection tool Nagios and its plug-in configuration