####yum install##
yum install gcc gcc-c++ openssl* ntp perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y
echo 'export LC_ALL=C'>> /etc/profile
tail -1 /etc/profile
source /etc/profile
/usr/sbin/ntpdate pool.ntp.org
####install nagios###
/usr/sbin/adduser nagios -M -s /sbin/nologin
tar zxf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make && make install
ls /usr/local/nagios/libexec/|wc -l
cd ..
####install 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 ..
#####install Params####
tar zxvf Params-Validate-0.91.tar.gz
cd Params-Validate-0.91
perl Makefile.PL
make
make install
cd ..
####install Class######
tar zxvf Class-Accessor-0.31.tar.gz
cd Class-Accessor-0.31
perl Makefile.PL
make
make install
cd ..
#####install Config#####
tar zxvf Config-Tiny-2.12.tar.gz
cd Config-Tiny-2.12
perl Makefile.PL
make
make install
cd ..
####install Math-Calc#####
tar zxvf Math-Calc-Units-1.07.tar.gz
cd Math-Calc-Units-1.07
perl Makefile.PL
make
make install
cd ..
#####install Regexp#####
tar zxvf Regexp-Common-2010010201.tar.gz
cd Regexp-Common-2010010201
perl Makefile.PL
make
make install
cd ..
####install Nagios-Plugin###
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
cp -rf check_iostat /usr/local/nagios/libexec/
cp -rf check_memory.pl /usr/local/nagios/libexec/
dos2unix /usr/local/nagios/libexec/check_iostat
dos2unix /usr/local/nagios/libexec/check_memory.pl
chmod 755 /usr/local/nagios/libexec/check_iostat
chmod 755 /usr/local/nagios/libexec/check_memory.pl
转载于:https://blog.51cto.com/cuncai2014/1433284