###yum安装相关插件及更新变量

yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y
echo 'export LC_ALL=C'>> /etc/profile
tail -1 /etc/profile
source /etc/profile
yum install ntp -y
/usr/sbin/ntpdate pool.ntp.org


####编译安装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
cd ..
ls /usr/local/nagios/libexec/|wc -l


####编译安装nrpe####
tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
#生成nrpe.cfg
make install-daemon-config  
cd ..


#####Params编译####
tar zxvf Params-Validate-0.91.tar.gz
cd Params-Validate-0.91
perl Makefile.PL
make  
make install
cd ..
####编译Class######
tar zxvf Class-Accessor-0.31.tar.gz
cd Class-Accessor-0.31
perl Makefile.PL
make  
make install
cd ..
#####编译Config#####
tar zxvf Config-Tiny-2.12.tar.gz
cd Config-Tiny-2.12
perl Makefile.PL
make  
make install
cd ..
####编译Math-Calc#####
tar zxvf Math-Calc-Units-1.07.tar.gz
cd Math-Calc-Units-1.07
perl Makefile.PL
make  
make install
cd ..
#####编译Regexp#####
tar zxvf Regexp-Common-2010010201.tar.gz
cd Regexp-Common-2010010201
perl Makefile.PL
make  
make install
cd ..
####编译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