Installing the Nagios Client
The client only needs to install the following content
Class-accessor-0.31.tar.gz
Config-tiny-2.12.tar.gz
Math-calc-units-1.07.tar.gz
Nagios-plugin-0.34.tar.gz
Params-validate-0.91.tar.gz
Regexp-common-2010010201.tar.gz
Check_iostat
check_memory.pl
Nrpe-2.12.tar.gz
First step: Modify the Yum source code
cd/etc/yum.repos.d/
Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repo
Step two: Adjust the character set
echo ' Export lc_all=c ' >>/etc/profile
Source/etc/profile
Echo $LC _all
Part III: Shutting down the firewall
/etc/init.d/iptables stop
/etc/init.d/iptables stop
Chkconfig iptables off
Setenforce 0 #临时生效
Sed-i ' s#selinux=enforcing#selinux=disabled#g '/etc/selinux/config #永久生效
Setenforce 0
Sed-i ' S#selinux=enforcing#selinux=disabled#g '/etc/selinux/config
Part fourth: Time synchronization
/usr/sbin/ntpdate pool.ntp.org
echo ' #time sync ' >>/var/spool/cron/root
Echo ' */10 * * * * */usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1 ' >>/var/spool/cron/root
Crontab-l
Fifth step: Create Nagios users
/usr/sbin/useradd-m nagios-s/sbin/nologin
Sixth step: Install the Nagios client plug-in
[!-d/home/lvnian/tools] && mkdir/home/lvnian/tools-p
Cd/home/lvnian/tools
Yum-y Install Perl-devel Openssl-devel
Tar zxf nagios-plugins-1.4.16.tar.gz
CD nagios-plugins-1.4.16
./configure--prefix=/usr/local/nagios--enable-perl-modules--enable-redhat-pthread-workaround
Make && make install
Cd.. /
Ls/usr/local/nagios/libexec/|wc-l
cd/home/lvnian/tools/
Tar zxf nrpe-2.12.tar.gz
CD nrpe-2.12
./configure
Make all
Make Install-plugin
Make Install-daemon
Make Install-daemon-config
Cd..
#----------------------------------------
cd/home/lvnian/tools/
Tar zxvf params-validate-0.91.tar.gz
CD params-validate-0.91
Perl makefile.pl
Make
Make install
Cd..
#----------------------------------------
cd/home/lvnian/tools/
Tar zxvf class-accessor-0.31.tar.gz
CD class-accessor-0.31
Perl makefile.pl
Make
Make install
Cd..
#----------------------------------------
cd/home/lvnian/tools/
Tar zxvf config-tiny-2.12.tar.gz
CD config-tiny-2.12
Perl makefile.pl
Make
Make install
Cd..
#----------------------------------------
cd/home/lvnian/tools/
Tar zxvf math-calc-units-1.07.tar.gz
CD math-calc-units-1.07
Perl makefile.pl
Make
Make install
Cd..
#----------------------------------------
cd/home/lvnian/tools/
Tar zxvf regexp-common-2010010201.tar.gz
CD regexp-common-2010010201
Perl makefile.pl
Make
Make install
Cd..
#----------------------------------------
cd/home/lvnian/tools/
Tar zxvf nagios-plugin-0.34.tar.gz
CD nagios-plugin-0.34
Perl makefile.pl
Make
Make install
Cd..
#______________________
#for Monitor Iostat
Yum Install Sysstat-y
Yum Install Dos2unix-y
/bin/cp/home/lvnian/tools/check_memory.pl/usr/local/nagios/libexec
/bin/cp/home/lvnian/tools/check_iostat/usr/local/nagios/libexec
chmod 755/usr/local/nagios/libexec/check_memory.pl
chmod 755/usr/local/nagios/libexec/check_iostat
dos2unix/usr/local/nagios/libexec/check_memory.pl
Dos2unix/usr/local/nagios/libexec/check_iostat
##################################################
Configuring the Nrpe configuration file
Perl-pi-e ' s/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,10.0.0.3/g '/usr/local/nagios/etc/nrpe.cfg
or sed-i ' s/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,10.0.0.3/g '/usr/local/nagios/etc/nrpe.cfg
The goal of this step is to allow the Nagios server to come here to get the design
#delete 199--203
Cp/usr/local/nagios/etc/nrpe.cfg/usr/local/nagios/etc/nrpe.cfg.ori
Sed-i ' 199,203d '/usr/local/nagios/etc/nrpe.cfg
echo "Command[check_load]=/usr/local/nagios/libexec/check_load-w 15,10,6-c 30,25,20" >>/usr/local/nagios/etc /nrpe.cfg
echo "Command[check_mem]=/usr/local/nagios/libexec/check_memory.pl-w 6%-C 3%" >>/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-c" >>/usr/local/nagios/etc/ Nrpe.cfg
Start the Nagios client Nrpe
Pkill Nrpe
Sleep 2
/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d
echo "#nagios Nrpe process cmd by Lvnian 2012-6-7" >>/etc/rc.local
echo "/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d" >>/etc/rc.local
Netstat-lnt|grep 5666
To restart the Nagios Nrpe command:
Pkill Nrpe &&/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d | | /usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d
netstat-lnt | grep 5666
Check the number of plugins
[Email protected] etc]# ls/usr/local/nagios/libexec/|wc-l
64
[Email protected] tools]# ls/usr/local/nagios/libexec/|wc-l
62
This article is from the "Struggle Bar" blog, please be sure to keep this source http://lvnian.blog.51cto.com/7155281/1703150
Nagios Client Simple Installation