Turn off selinux
Setenforce 0
The permanent method is
Vi/etc/selinux/config
Change status to Disabled
Selinux=disabled
Need to restart the server, not restart here temporarily
Shutting down the firewall
/etc/init.d/iptables stop
Remove firewall rules, restart Firewall
Mv/etc/sysconfig/iptables/opt
/etc/init.d/iptables restart
installing the Epel update source
wgethttp://dl.fedoraproject.org/pub/epel/6server/x86_64/epel-release-6-8.noarch.rpm
rpm-ivhepel-release-6-8.noarch.rpm
Vi/etc/yum.repos.d/epel.repo
Replace all HTTPS with the following name as http
:%s/https/http/g
Yum-y Installyum-fastestmirror
RPM--import/etc/pki/rpm-gpg/rpm*
installation components, Note: LAMP the environment is with Yum installed, included in the following command
Yum-y install httpdgettext mysql mysql-server mysql-devel php php-mysql php-pear php-mysql mysqlperl mysql-server Perl-DB I perl-dbd-mysql httpd gcc glibc glibc-common gdgd-devel php gcc automake autoconf libtool make Cairo-devel libxml2-develp Ango-devel Pango libpng-devel freetype freetype-devel libart_lgpl-devel php-gdmysql-connector-odbc libgd libgd-devel Libpng libpng-devel libjpeglibjpeg-devel zlib zlib-devel libxml2 libxml2-devel cairo* pango-devel*cairo-devel* Perl-cpan Gruff NTP wget BC Perl-time-hires dejavu-lgc-sans-fonts mailxpatch
Clear Cache
Yum Clean All
Create Nagios users and Groups
Useradd Nagios
Usermod-s/sbin/nologinnagios
Groupadd Nagcmd
Usermod-g Nagcmd Nagios
Usermod-g Nagcmd Apache
Installing Nagios
Tar zxvfnagios-4.0.8.tar.gz-c/usr/src/
cd/usr/src/nagios-4.0.8/
Download the patch file from the following page
Http://tracker.nagios.org/file_download.php?file_id=205&type=bug
Patch , or message log error "Wproc:unknown job Type:10"
PATCH-P1 <bogus_warnings.patch
./configure--prefix=/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios--with-command-group= Nagcmd-with-gd-lib=/usr/lib64-with-gd-inc=/usr/include
Make all
Make install
Make Install-init
Make Install-commandmode
Make Install-config
Make install-webconf
cd/root/
installing the Nagios plug-in package
Tar zxvfnagios-plugins-2.0.3.tar.gz-c/usr/src/
cd/usr/src/nagios-plugins-2.0.3/
./configure--with-nagios-user=nagios--with-nagios-group=nagios
Make && make install
cd/root/
define the password for the Nagios access
Htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
Installing the drawing plug-in
Tar zxvfrrdtool-1.4.7.tar.gz-c/usr/src/
cd/usr/src/rrdtool-1.4.7/
./configure--prefix=/usr/local/rrdtool
Make && Makeinstall
Cd/root
Editing the system environment variable configuration file
Vi/etc/profile
Add on last line
Path= $PATH:/usr/local/rrdtool/bin
Reload the configuration file
Source/etc/profile
View version information for RRDtool
Rrdtool-v
Installing the Drawing Components
Tar zxvf pnp4nagios-0.6.25.tar.gz-c/usr/src/
cd/usr/src/pnp4nagios-0.6.25/
./configure--prefix=/usr/local/pnp4nagios--with-rrdtool=/usr/local/rrdtool/bin/rrdtool--with-nagios-user= Nagios--with-nagios-group=nagios--with-perl_lib_path=/usr/local/rrdtool/lib/perl/5.10.1/x86_64- linux-thread-multi/
Make all
Make install
Make install-webconf
Make Install-config
Make Install-init
Make Fullinstall
Copying a configuration file
Cd/usr/local/pnp4nagios/etc
Cp-pmisccommands.cfg-sample misccommands.cfg
Cp-p nagios.cfg-samplenagios.cfg
Cp-p rra.cfg-samplerra.cfg
CD pages/
Cp-pweb_traffic.cfg-sample web_traffic.cfg
Cd.. /check_commands/
Cp-p check_all_local_disks.cfg-samplecheck_all_local_disks.cfg
Cp-pcheck_nrpe.cfg-sample check_nrpe.cfg
Cp-pcheck_nwstat.cfg-sample check_nwstat.cfg
compiling Nagios configuration file
cd/usr/local/nagios/etc/
CP Nagios.cfgnagios.cfg.bak
VI nagios.cfg
Process_performance_data=1
Host_perfdata_command=process-host-perfdata
Service_perfdata_command=process-service-perfdata
Last line add
Service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
Service_perfdata_file_template=datatype::serviceperfdata\ttimet:: $TIMET $\thostname:: $HOSTNAME $\tservicedesc::$ Servicedesc$\tserviceperfdata:: $SERVICEPERFDATA $\tservicec::heckcommand:: $SERVICECHECKCOMMAND $\thoststate::$ Hoststate$\thoststatetype:: $HOSTSTATETYPE $\tservicestate:: $SERVICESTATE $\tservicestatetype:: $SERVICESTATETYPE $
Service_perfdata_file_mode=a
Service_perfdata_file_processing_interval=15
Service_perfdata_file_processing_command=process-service-perfdata-file
#
# host PerformanceData starting with Nagios 3.0
#
Host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
Host_perfdata_file_template=datatype::hostperfdata\ttimet:: $TIMET $\thostname:: $HOSTNAME $\thostperfdata::$ Hostperfdata$\thostcheckcommand:: $HOSTCHECKCOMMAND $\thoststate:: $HOSTSTATE $\thoststatetype:: $HOSTSTATETYPE $
Host_perfdata_file_mode=a
Host_perfdata_file_processing_interval=15
Host_perfdata_file_processing_command=process-host-perfdata-file
Editing a configuration file
CD objects/
CP Commands.cfgcommands.cfg.bak
Last line add
VI commands.cfg
Define Command{
Command_name Process-service-perfdata-file
Command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl--bulk=/usr/local/pnp4nagios/var/service-perfdata
}
Define Command{
Command_name Process-host-perfdata-file
Command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl--bulk=/usr/local/pnp4nagios/var/host-perfdata
}
Edit Template file
CP Templates.cfgtemplates.cfg.bak
VI templates.cfg
Last line add
Define host {
Name Host-pnp
action_url/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv=_host_
Register 0
}
Define Service {
Name Srv-pnp
action_url/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv= $SERVICEDESC $
Register 0
}
or Add the following sentence in the Generic-service service template
action_url/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv= $SERVICEDESC $
Also add the following sentence to the local-service template
Action_url/pnp4nagios/index.php?host= $HOSTNAME $
Check Configuration
.. /.. /bin/nagios-v. /nagios.cfg
Start Nagios
/etc/init.d/nagios start
/ETC/INIT.D/HTTPD start
Edit a Web page configuration file
Vi/etc/httpd/conf.d/nagios.conf
Last line add
Alias/pnp4nagios "/usr/local/pnp4nagios/share"
<directory "/usr/local/pnp4nagios/share" >
AllowOverride None
Order Allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
authuserfile/usr/local/nagios/etc/htpasswd
Require Valid-user
<ifmodule mod_rewrite.c>
Rewriteengine on
Options FollowSymLinks
rewritebase/pnp4nagios/
Rewriterule ^ (application|modules|system)-[f,l]
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewriterule. * Index.php/$0[pt,l]
</IfModule>
</Directory>
Check http configuration
Apachectl-t
Restart Service
/ETC/INIT.D/HTTPD restart
/etc/init.d/nagiosrestart
visit the Naigos page and click on the icon of the RRD drawing behind current Load 650) this.width=650; "src=" http:// S3.51cto.com/wyfs02/m00/6c/83/wkiol1vlftyj90cjaaagnh02vgs017.jpg "title=" Qq20150507152654.png "alt=" Wkiol1vlftyj90cjaaagnh02vgs017.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/83/wKioL1VLFN7jQ4QXAAK6SAeYmXM701.jpg "title=" Qq20150507152519.png "alt=" Wkiol1vlfn7jq4qxaak6saeymxm701.jpg "/>
Hint Green font, indicating success, prompt duplicate name file
Rename the following file
Cd/usr/local/pnp4nagios/share
MV Install.phpinstall.php.bak
Refreshing the page again is normal.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6C/87/wKiom1VLE4Kyb8bBAAIKNIphCKY562.jpg "title=" Qq20150507152544.png "alt=" Wkiom1vle4kyb8bbaaikniphcky562.jpg "/>
If a red box appears, it means that no fonts are installed
Yum Install-y dejavu-lgc-sans-fonts
You can refresh it again.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/83/wKioL1VLFROSZXKhAAF4a1E70XI614.jpg "title=" Qq20150507152614.png "alt=" Wkiol1vlfroszxkhaaf4a1e70xi614.jpg "/>
If you are prompted to perform an action on the Web page
Could not open command File/usr/local/nagios/var/rw/nagiosnand ' for update
here's how to fix it:
Usermod-a-G Nagiosapache
chmod 666/usr/local/nagios/var/rw/nagiosnand
Chown NAGIOS.NAGCMD/USR/LOCAL/NAGIOS/VAR/RW
chmod U+RWX/USR/LOCAL/NAGIOS/VAR/RW
chmod G+RWX/USR/LOCAL/NAGIOS/VAR/RW
chmod G+S/USR/LOCAL/NAGIOS/VAR/RW
This article is from the "Falling Star" blog, make sure to keep this source http://xiao987334176.blog.51cto.com/2202382/1643881
CentOS 6.5 Nagios 4.0.8 Installation