1. nagios monitoring Client installation 1. nagios installation # wgethttp: # cdnagios-3.2.2 # useradd-m-sbinbashnagios # groupaddnagios # usermod-gnagiosng
1. Install nagios monitoring
1. Install nagios# Wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.2.tar.gz
# Tar zxvf nagios-3.2.2.tar.gz
#
CdNagios-3.2.2
# Usera
Dd-M-s/bin/bash nagios
# Groupadd nagios
# Use
RmOd-G nagios
# Groupadd nagcmd
#
Usermod-A-G nagcmd nagios
# Usermod-a-G nagcmd www
#./Configure -- prefix =/data/nagios -- with-command-group = nagcmd
# Make
# Make all
# Make install
# Make install-init # generate the init Startup Script
# Make install-config # install the sample configuration file
# Make install-commandmode # Set the corresponding directory permissions
2. Install the nagiox plug-in# Wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
# Tar zxvf nagios-plugins-1.4.15.tar.gz
# Cd nagios-plugins-1.4.15
#./Configure -- with-nagios-user = nagios -- with-nagios-group = nagios -- prefix =/data/nagios
# Make
# Make install
3. nrpe Installation# Tar zxvf nrpe-2.12.tar.gz
# Cd nrpe-2.12
#./Configure
# Make all
#
CpSrc/check_nrpe/data/nagios/lib
ExEc/
4. Configuration
# Add to system service and set it to automatic upon startup
#
Chkconfig-- Add nagios
# Chkconfig nagios on #
Mkdir/Data/nagios/var/rw
#
ChownNagios. nagios/data/nagios/var/rw # test configuration file availability
#/Data/nagios/bin/nagios-v/data/nagios/etc/nagios. cfg # cancel user authentication (convenient debugging)
# Vi/data/nagios/etc/cgi. cfg
Select use_authenti.
CatIon = 1 and change the value to 0 # modify the contact email address
# Vi/data/nagios/etc/objects/contacts. cfg # define check_nrpe
Command
# Vi/data/nagios/etc/objects/commands. cfg
Define command {
Command_name check_nrpe
Command_line/data/nagios/libexec/check_nrpe-H $ HOSTADDRESS $-c $ ARG1 $
}
# Start the service
# Service nagios start
5. nginx Configuration
Nginx cgi support see Nginx fastcgi perl (pl, cgi) Support http://www.linuxIdC.com/linux/2011-09/41019.htm
Server {
Listen 88;
Server_name _;
Location /{
Root/data/nagios/share;
Index index.html index.htm index.Php;
}
Location ~ . * \. (Php | php5 )? $
{
Root/data/nagios/share;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
INcLude fcgi. conf;
}
Location/nagios {
Alias/Data/nagios/share;
}
Location/cgi-bin/images {
Alias/data/nagios/share/images;
}
Location/cgi-bin/stylesheets {
Alias/data/nagios/share/stylesheets;
}
Location/cgi-bin {
Alias/data/nagios/sbin;
}
Location ~ . * \. (Cgi | pl )? $
{
GZipOff;
Root/data/nagios/sbin;
ReWrite^/Nagios/cgi-bin/(. *) \. cgi/$ 1.cgi break;
Fastcgi_pass unix:/data/nginx/logs/perl-fcgi.sock;
Fastcgi_index index. cgi;
Fcinclude gi. conf;
Fastcgi_read _TimeOut 60;
}
}