Environment: A 2.6.32-431.el6.x86_64
Installation Preparation:
To modify a Yum Source:
Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repo
To adjust the character set:
echo "Export Lc_all=c" >>/etc/profile
Source/etc/profile
Close iptables:
/etc/init.d/iptables stop
Chkconfig iptables off
Turn off SELinux
Sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/selinux/config
Setenforce 0-selinux run in Warning (permissive) mode
Set time synchronization:
Echo ' */5 * * * * */usr/sbin/ntpdate time.nist.gov >/dev/null 2>&1 ' >>/var/spool/cron/root
Crontab-l
To install the Web program:
Yum Install gcc glibc-common-y
Yum Install GD gd-devel-y
Yum install httpd php php-gd mysql*-y
#有lamp就无需安装
To create users and groups:
Useradd-m Nagios
Groupadd Nagcmd
Usermod-a-G Nagcmd Nagios
Usermod-a-G Nagcmd www
Note: Nagios and Apache authorize the same user group
Upload Related packages:
nagios-3.5.1.tar.gz Main Program
NAGIOS-PLUGINS-1.4.16.TAR.GZ Plug-in program
nrpe-2.12.tar.gz Client Nrpe Daemon
pnp-0.4.14.tar.gz rrdtool-1.2.14.tar.gz Drawing Web Program
Check_iostat Check_mysql. such as plugins, the default does not
To compile and install the main program:
Tar xzf nagios-3.5.1.tar.gz
CD Nagios
./configure--with-command-group=nagcmd
Make all
Make install
Make Install-init
#初始化, generate a startup script
Make Install-config
#安装目录许可, Web File
Make Install-commandmode
#安装配置文件模版
Make install-webconf
#生成web. conf, a configuration file that is equivalent to Nagios's login on the Web interface.
Htpasswd-cb/usr/local/nagios/etc/htpasswd.users Admin 123456
#生成用户, htpasswd-cb-c specifies file-B non-interactive
#如果web是编译安装make install-webconf execution fails with an error and the path is incorrect.
Manual configuration required: Cp-ap sample-config/httpd.conf/application/apache/conf/extra/nagios.conf
echo "Include/application/apache/conf/extra/nagios.conf" >>/application/apache/conf/httpd.conf
/application/apache/bin/htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
Note: Observe the information of the sample-config/httpd.conf configuration file! Generate Htpasswd.users and httpd.conf in the name to be consistent, and nagiosadmin and/usr/local/nagios/etc, cgi.cfg users to be consistent! Otherwise error view verbose log.
Installing the plugin nagios-plugins-1.4.16.tar.gz
Yum-y Install Perl-devel
#perl-devel is a must.
Tar zxf nagios-plugins-1.4.16.tar.gz
CD nagios-plugins-1.4.16
./configure--with-nagios-user=nagios--with-nagios-group=nagios--enable-perl-modules
Make && make install
Cd.. /
Ls/usr/local/nagios/libexec/|wc-l
#根据环境安装不等的插件, how much it doesn't matter.
Installing Nrpe
Tar zxvf nrpe-2.12.tar.gz
CD nrpe-2.12
./configure
Make all
Make Install-plugin
Make Install-daemon
Make Install-daemon-config
Cd..
Production of Nrpe for detecting clients, and of course for detecting
Ls/usr/local/nagios/libexec/check_nrpe
Launch Apache Nagios
/etc/init.d/nagios start
Ps-ef | grep Nagios
Lsof-i: 80
#注意nagios主进程没有端口, all through the plug-in detection!
Chkconfig--add Nagios
Chkconfig--level and Nagios on
Chkconfig--list Nagios
Web login can
This article from "As always" blog, declined reprint!
Nagios server-side installation and installation preparation