I. Installation of the service side
Required installation package: Http://pan.baidu.com/s/1dFKaM8D
Environment: Centos7 ip:192.168.217.131
(1) Step 1:install gcc and lamp env etc
Yum Install GCCGLIBC glibc-common-y
Yum Install Gdgd-devel-y
Yum installhttpd php php-gd-y
Yum installmysql*-y
(2) Step 2:add nagios user and Group
/usr/sbin/useradd-m Nagios
#/usr/sbin/useraddapache
/usr/sbin/groupaddnagcmd
/usr/sbin/usermod-a-G Nagcmd Nagios
/usr/sbin/usermod-a-G Nagcmd Apache
(3) Step 3:download and install Nagios
Unzipoldboy_training_nagios_soft.zip
Tar xzfnagios-3.5.1.tar.gz
CD Nagios
./configure "--with-group=nagios--with-user=nagios
"--with-command-group=nagcmd
Make all
Make install
Makeinstall-init
Makeinstall-config
Makeinstall-commandmode
Makeinstall-webconf # appears 404, stating that this is not done
(4) Step 4:config Web Auth
Htpasswd-cb/usr/local/nagios/etc/htpasswd.users Tong 123456// user authentication, login Nagios
(5) Step 5:install nagios-plugins
Yum-y Installperl-devel
Tar zxfnagios-plugins-2.1.1.tar.gz
cdnagios-plugins-2.1.1
./configure--with-nagios-user=nagios--with-nagios-group=nagios--
Enable-perl-modules
Make &&make Install
Ls/usr/local/nagios/libexec/|wc-l See a few
(6) Step 6:install Nrpe
Tar zxvfnrpe-2.12.tar.gz
CD nrpe-2.12
./configure
Make all
Makeinstall-plugin
Makeinstall-daemon
Makeinstall-daemon-config
(7) Step 7:startup service and check
/etc/init.d/nagios start
Service httpd Start
Echo-----------
Lsof-i tcp:80
Echo----------
Ps-ef|grepnagios no process, iptables-f.
echo "NAGIOS is successfully installed."
Echo OK
My visit Address: http://192.168.217.131/nagios/
Two. installation of the client
Environment: Centos7 ip:192.168.217.137
(1) Step 1:add nagios User
#useradd-mnagios-s/sbin/nologin
(2) Step 2:install nagios-plugins
Yum-y Install Perl-devel
Tar zxfnagios-plugins-2.1.1.tar.gz
cdnagios-plugins-2.1.1
./configure--prefix=/usr/local/nagios--enable-perl-modules--enable-redhat-pthread-workaround
Make &&make Install
Ls/usr/local/nagios/libexec/|wc-l
(3) Step 3:install Nrpe
Tar zxfnrpe-2.12.tar.gz
CD nrpe-2.12
./configure
Make all
Makeinstall-plugin
Makeinstall-daemon
Makeinstall-daemon-config
(4) Step 4:install soft for iostat
Tar zxvfparams-validate-0.91.tar.gz
cdparams-validate-0.91
Perl makefile.pl
Make
Make install
#----------------------------------------
Tar zxvfclass-accessor-0.31.tar.gz
cdclass-accessor-0.31
Perl makefile.pl
Make
Make install
#----------------------------------------
Tar zxvfconfig-tiny-2.12.tar.gz
CD config-tiny-2.12
Perl makefile.pl
Make
Make install
#----------------------------------------
Tar zxvfmath-calc-units-1.07.tar.gz
cdmath-calc-units-1.07
Perl makefile.pl
Make
Make install
#----------------------------------------
Tar zxvfregexp-common-2010010201.tar.gz
cdregexp-common-2010010201
Perl makefile.pl
Make
Make install
#----------------------------------------
Tar zxvfnagios-plugin-0.34.tar.gz
cdnagios-plugin-0.34
Perl makefile.pl
Make
Make install
#______________________
#for Monitoriostat
Yum Installsysstat-y
"check_memory.pl installation package has"
/bin/cp/home/oldboy/tools/check_memory.pl/usr/local/nagios/libexec
/bin/cp/home/oldboy/tools/check_iostat/usr/local/nagios/libexec
chmod 755/usr/local/nagios/libexec/check_memory.pl
chmod 755/usr/local/nagios/libexec/check_iostat
Yum Install-ydos2unix
dos2unix/usr/local/nagios/libexec/check_memory.pl
Dos2unix/usr/local/nagios/libexec/check_iostat
Ls/usr/local/nagios/libexec/|wc-l number of plugins
(5) Step 5: Modify nrpe.cfg
cd/usr/local/nagios/etc/# configuration file path
#cp NRPE.CFGNRPE.CFG.BK Backup
#vim nrpe.cfg+79
Perl-pi-e ' S/ALLOWED_HOSTS=127.0.0.1/
"allowed_hosts=127.0.0.1,192.168.217.131 ( service side )"/g '
#delete 199--203"deleted line"
Cp/usr/local/nagios/etc/nrpe.cfg/usr/local/nagios/etc/nrpe.cfg.ori # Copy
Sed-i ' 199,203d '/usr/local/nagios/etc/nrpe.cfg
echo "Command[check_load]=/usr/local/nagios/libexec/check_load-w 15,10,6
-c30,25,20 ">>/usr/local/nagios/etc/nrpe.cfg
echo "Command[check_mem]=/usr/local/nagios/libexec/check_memory.pl-w 6%
-c3% ">>/usr/local/nagios/etc/nrpe.cfg
echo "Command[check_disk]=/usr/local/nagios/libexec/check_disk-w 20%-C
8%-p/">>/usr/local/nagios/etc/nrpe.cfg
echo "Command[check_swap]=/usr/local/nagios/libexec/check_swap-w 20%-C
10% ">>/usr/local/nagios/etc/nrpe.cfg
echo "Command[check_iostat]=/usr/local/nagios/libexec/check_iostat-w 6
-C10 ">>/usr/local/nagios/etc/nrpe.cfg
(6) Step 6:start Nagios Client
#start nagiosclient
Pkill Nrpe
Sleep 2
#/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d # Boot
#echo "/usr/local/nagios/bin/nrpe-c-/usr/local/nagios/etc/nrpe.cfg-
D ">>/etc/rc.local boot automatically
#netstat-lnt|grep 5666 && echo "Nagios client is OK"
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8C/14/wKioL1hhztnzgvsnAABgHQ3LQcY900.png-wh_500x0-wm_3 -wmp_4-s_600297708.png "title=" 1.png "alt=" Wkiol1hhztnzgvsnaabghq3lqcy900.png-wh_50 "/>
Three. Login Verification:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8C/15/wKioL1hh06KQ2cEjAAAq2h80Aoo642.png-wh_500x0-wm_3 -wmp_4-s_863499346.png "style=" Float:none; "title=" 2.png "alt=" Wkiol1hh06kq2cejaaaq2h80aoo642.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8C/18/wKiom1hh06OhxiDEAAEBXFa2PMo073.png-wh_500x0-wm_3 -wmp_4-s_2622122628.png "style=" Float:none; "title=" 4.png "alt=" Wkiom1hh06ohxideaaebxfa2pmo073.png-wh_50 "/>
Because there is no machine to start the client, you can only see the server's machine up
This article from "Do not forget Beginner's mind" blog, reproduced please contact the author!
Installation of Nagios monitoring