注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

A small step

Judgement Must

 
 
 

日志

 
 
关于我

不要因为急着赶路,让自己的步伐杂乱。远方是既定的目标,但路上才是最重要的经历!

网易考拉推荐

nagios client  

2015-07-24 11:24:01|  分类: 系统监控 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
function check_version() {
   case `cat /etc/debian_version` in
    4.0)
 echo "deb http://archive.debian.org/debian/ etch main contrib" >> /etc/apt/sources.list 
 exit 0
 ;;
5.0)
 echo "deb http://archive.debian.org/debian/ lenny main contrib" >> /etc/apt/sources.list 
 exit 0
 ;;
*)
 echo "debian version is other" >>error.txt
 exit 1
 ;;
esac
}
function fun_dpkg() {
    if `dpkg -l |grep libssl-dev`
then
 :
else 
  apt-get -y install libssl-dev || echo "libssl-dev installed" && echo "libssl-dev install error"
fi
}
function check_dns() {
    if `ping -c 2 --------`
     then 
      echo "dns ip is ok"
else
 echo  "dns ip is error"
 echo "nameserver 202.-----" > /etc/resolv.conf
fi
}
function check_route(){
     if `ping -c 2 202.------`
 then 
  echo "route is ok"
 else
  route add default gw 202.---
fi
}

function nagios_inst() {

wget http://---------/distfiles/openssl-1.0.1h.tar.gz
mkdir -p /opt/distfiles  /opt/distfiles
mv openssl-1.0.1h.tar.gz /opt/distfiles
cd /opt/distfiles
tar -zxvf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config
make
make test
make install

#install nagios-plugins
useradd -s /sbin/nologin nagios
echo install nagios-plugins
mkdir -p /opt/distfiles
cd /opt/distfiles
wget http://------/distfiles/nagios-client.tar.gz
tar -zxvf nagios-client.tar.gz
cd /opt/distfiles/nagios-client
tar -zxvf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --prefix=/usr/local/nagios
make
make install
chown nagios.nagios /usr/local/nagios/
chown -R nagios.nagios /usr/local/nagios/libexec/
#install nrpe
echo  install nrpe...
cd ..
tar -zxvf nrpe-2.14.tar.gz 
cd nrpe-2.14
./configure --prefix=/usr/local/nagios/ 
make all 
make install-plugin
make install-daemon
make install-daemon-config


cat > /usr/local/nagios/etc/nrpe.cfg <<EOF
log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=202.205.109.22

dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% 
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 250 -c 300
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 70 -c 80
command[check_mem]=/usr/local/nagios/libexec/check_mem.sh --raw -w 85 -c 95 
command[check_uptime]=/usr/local/nagios/libexec/check_uptime 
EOF

cd /opt/distfiles/nagios-client/libexec
\cp -r * /usr/local/nagios/libexec
chown -R nagios.nagios /usr/local/nagios/libexec/
echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" >> /etc/rc.local

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d  
netstat -utpln |grep nrpe

}

#!/bin/bash

if grep "CentOS" /boot/grub/menu.lst
    then
    nagios_inst
fi
  评论这张
 
阅读(29)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018