Chinaunix首页 | 论坛 | 博客
  • 博客访问: 485281
  • 博文数量: 173
  • 博客积分: 4112
  • 博客等级: 上校
  • 技术积分: 1577
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-26 10:12
文章分类

全部博文(173)

文章存档

2012年(1)

2010年(172)

我的朋友

分类:

2010-02-26 10:57:31

nrpe自动安装脚本
#!/bin/sh
#nrpe install script writed by sery([email=sery@163.com),2009-11-23]
Os_is=`uname`
Nagios_is=`grep nagios /etc/passwd | wc -l`
if [ "$Os_is" = "Linux" ]
then
  ipadd=$(ifconfig | sed -n ‘2p’|awk ‘{print $2}’|awk -F: ‘{print $2}’)
  if [ $Nagios_is = 0 ]
  then
    useradd nagios -s /sbin/nologin
  fi
elif [ "$Os_is" = "FreeBSD" ]
   then
    ipadd=$(ifconfig | sed -n ‘4p’|awk ‘{print $2}’)
    if [ $Nagios_is = 0 ]
    then
    /usr/sbin/pw useradd nagios -s /sbin/nologin
    fi
else echo “this is other os,please modify the script”
exit 1
fi
#install nrpe
PREFIX=/usr/local/nrpe
tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure –prefix=$PREFIX
make
make install
echo “nrpe install ok….!”
sleep 3
cd ..
if [ ! -d $PREFIX/etc ]
   then
     mkdir $PREFIX/etc
fi
#install nagios-plugins
tar zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure –prefix=$PREFIX
make
make install
cd ..
echo “nagios-plugins is ok!”
sleep 3
#setting nrpe
cp ip_conn.sh $PREFIX/libexec
chmod -R +x $PREFIX/libexec
sed -e /^server_add/s/$/”$ipadd”/ -e /^allowed_hosts/s/$/$ipadd/ nrpe.cfg > $PREFIX/etc/nrpe.cfg
#running nrpe
cd $PREFIX
bin/nrpe -c etc/nrpe.cfg -d
echo “haha! nrpe is running!!!”
阅读(621) | 评论(0) | 转发(0) |
0

上一篇:ipvsadm LVS负载

下一篇:数字比较及计算

给主人留下些什么吧!~~