nagios_client_V2_sh

发布时间:2020-07-24 18:20:32 作者:Liyanchaolinux
来源:网络 阅读:7797
#!/bin/sh
function nagios(){
yum install gcc glibc glibc-common openssl-devel dos2unix -y
/usr/sbin/useradd -m nagios -s /sbin/nologin
cd /application/tools/
unzip oldboy_training_nagios_soft.zip
yum -y install perl-devel
tar zxf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --prefix=/application/nagios --enable-perl-modules --enable-redhat-pthread-workaround 
make && make install
cd ../
#ls /application/nagios/libexec/|wc -l
#----------------------------------------
cd /application/tools/
tar zxf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure  --prefix=/application/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
cd ..
#----------------------------------------
cd /application/tools/
tar zxvf Params-Validate-0.91.tar.gz 
cd Params-Validate-0.91 
perl Makefile.PL 
make  
make install 
cd .. 
#----------------------------------------
cd /application/tools/
tar zxvf Class-Accessor-0.31.tar.gz
cd Class-Accessor-0.31
perl Makefile.PL
make
make install
cd ..
#----------------------------------------
cd /application/tools/
tar zxvf Config-Tiny-2.12.tar.gz
cd Config-Tiny-2.12
perl Makefile.PL
make
make install
cd ..
#----------------------------------------
cd /application/tools/
tar zxvf Math-Calc-Units-1.07.tar.gz
cd Math-Calc-Units-1.07
perl Makefile.PL
make
make install
cd ..
#----------------------------------------
cd /application/tools/
tar zxvf Regexp-Common-2010010201.tar.gz
cd Regexp-Common-2010010201
perl Makefile.PL
make
make install
cd ..
#----------------------------------------
cd /application/tools/
tar zxvf Nagios-Plugin-0.34.tar.gz
cd Nagios-Plugin-0.34
perl Makefile.PL
make
make install
cd ..
#----------------------------------------
cd /application/tools/
yum install sysstat -y
/bin/cp /application/tools/check_memory.pl /application/nagios/libexec
/bin/cp /application/tools/check_iostat /application/nagios/libexec

chmod 755 /application/nagios/libexec/check_memory.pl
chmod 755 /application/nagios/libexec/check_iostat
dos2unix /application/nagios/libexec/check_iostat
dos2unix /application/nagios/libexec/check_memory.pl

#----------------------------------------
/bin/cp /application/nagios/etc/nrpe.cfg /application/nagios/etc/nrpe.cfg.ori
perl -pi -e 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,192.168.2.78/g' /application/nagios/etc/nrpe.cfg 
cp  /application/nagios/etc/nrpe.cfg  /application/nagios/etc/nrpe.cfg.ori
sed -i '199,203d'  /application/nagios/etc/nrpe.cfg
echo "command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,6 -c 30,25,20">>/application/nagios/etc/nrpe.cfg
echo "command[check_mem]=/usr/local/nagios/libexec/check_memory.pl -w 6% -c 3%">>/application/nagios/etc/nrpe.cfg
echo "command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 8% -p /">>/application/nagios/etc/nrpe.cfg
echo "command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%">>/application/nagios/etc/nrpe.cfg
echo "command[check_iostat]=/usr/local/nagios/libexec/check_iostat -w 6 -c 10">>/application/nagios/etc/nrpe.cfg
pkill nrpe 
sleep 2
/application/nagios/bin/nrpe -c /application/nagios/etc/nrpe.cfg -d
echo  "#nagios nrpe process cmd by liycwing 2014-12-25" >> /etc/rc.local
echo "/application/nagios/bin/nrpe -c /application/nagios/etc/nrpe.cfg -d">>/etc/rc.local
netstat -lnt|grep 5666 && echo "nagios client is ok"
}
nagios


推荐阅读:
  1. cisco 2811 安装HWIC-2FE卡 升级IOS 记录
  2. python如何使用matplotlib画柱状图、散点图

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

nagios client v1 监控 clien nt

上一篇:ACL 访问控制列表(二)

下一篇:iis发布的C#项目设置首页

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》