nagios_client_V1-sh

发布时间:2020-07-05 21:40:18 作者:Liyanchaolinux
来源:网络 阅读:1970
#!/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.91/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. 什么是mysql多实例及如何配置
  2. shodan使用笔记

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

nagios_client_v1-sh clien nt

上一篇:[C#进阶系列]专题二:你知道Dictionary查找速度为什么快吗?

下一篇:Navicat连接SQL Server报08001的错误

相关阅读

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

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