Note:
This document is based on Nagios+apache the mode, install Nagios must be pre-compiled and installed Apache , do not proceed here Apache compile and install the repeat.
One: Configuration Apache
# vi /usr/local/apache/conf/extra/httpd-vhosts.confnamevirtualhost *:80<virtualhost * : 80> servername 192.168.189.132 documentroot "/www" <Directory "/www" > order deny,allow Deny from all </Directory> #以下是apache上, Nagios configuration information required: 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" //Configuring Nagios user authentication Authuserfile /usr/local/nagios/etc/htpasswd Require valid-user </directory></VirtualHost>
Two: Create Nagios Users and Groups
# useradd nagios# groupadd nagios# usermod–a–gnagios nobody# usermod–a–gnagios Nagios
Two: Download Nagios related packages, and compile installation and environment configuration
# cd/usr/local/src# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz# wget/http prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz# wget/HTTP prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz# TAR-ZXVF nagios-3.4.1.tar.gz# TAR-ZXVF nagios-plugins-1.4.16.tar.gz# TAR-ZXVF nagios/nrpe-2.13.tar.gz
compiling and installing Nagios
# CD nagios-3.4.1/#./configure--prefix=/usr/local/nagios--with-command-group=nagios# make all# make install# make Inst all-init# make install-commandmode# make Install-config
compiling and installing the Nagios plugin
# CD: /nagios-plugins-1.4.16
#./configure--prefix=/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios
# Make && make install
compiling and installing Nrpe
# CD: /nrpe-2.13#./configure--prefix=/usr/local/nagios# make all# make Install-plugin
set nagios directory Permissions
# Chown–r nagios:nagios/usr/local/nagios/
Configure user password access
#/usr/local/apache/bin/htpasswd-cm/usr/local/nagios/etc/htpasswd nagiosadminnew password:re-type New password: Adding Password for usernagiosadmin
Three: Enable Nagiosand access the test
Open Apache service
#/usr/local/apache/bin/apachectl-k Start
detect Nagios configuration file syntax is correct
#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
If the syntax is correct, you can start Nagios normally
#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg-d
( can also be started using System service mode:service Nagios start)
Page Access Testing
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/87/2B/wKiom1fWYHHSeKSHAAEd6rMLqSk408.png "title=" 1.png " alt= "Wkiom1fwyhhsekshaaed6rmlqsk408.png"/>
The above page shows the success of the Nagios installation deployment. The subsequent need to add a host and service to the service before you can start monitoring.
This article from the "Play God Clown" blog, reproduced please contact the author!
Nagios Monitoring Server installation and deployment