nagios客户端自动安装shell脚本

#!/bin/bash
#install nagios client start....
sleep 1
/usr/sbin/useradd -m magios
mkdir -p /home/oldboy/tools/
cd /home/oldboy/tools
[ ! -f nagios.zip ] && {
echo "nagios soft is not exist."
exit 1
}
unzip nagios.zip
cd /home/oldboy/tools/

tar zxvf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure --prefix=/usr/local/nagios --enable-perl-modules --enable-redhat-pthread-workaroun
make
make install
cd ..

ls /usr/local/nagios/libexec/| wc -l

cd /home/oldboy/tools/
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 ..

cd /home/oldboy/tools/
tar zxvf Params-Validate-0.9.1.tar.gz
cd Params-Validate-0.91
perl Makefile.PL
make
make install
cd ..
cd /home/oldboy/tools/
tar zxvf Class-Accessor-0.31.tar.gz
cd Class-Accessor-0.31
perl    Makefile.PL
make
make install

yum install sysstat -y
/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

dos2unix  /usr/local/nagios/libexec/check_memory.pl
dos2unix  /usr/local/nagios/libexec/check_iostat

perl -pi -e 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,192.168.1.222/g' /usr/local/nagios/etc/nrpe.cnf

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_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 8% -p">>/usr/local/nagios/etc/nrpe.cfg
echo "command[check_procs]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%">>/usr/local/nagios/etc/nrpe.cfg

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d">>/etc/rc.local


分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS