Chinaunix首页 | 论坛 | 博客
  • 博客访问: 98428
  • 博文数量: 26
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 322
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-27 13:38
文章分类

全部博文(26)

文章存档

2014年(4)

2013年(22)

我的朋友

分类: 系统运维

2013-03-27 13:47:32

#!/bin/bash
if [ ! -d /data/source/nagios ];then
        mkdir -p /data/source/nagios
fi
SOFT_PATH=/data/source/nagios
NG_SERVER=192.168.1.179
LO_CLIENT=127.0.0.1
XIN_NRPE_PATH=/etc/xinetd.d/nrpe
PORT_NRPE_PATH=/etc/services 
yum -y install xinetd openssl-devel
download(){
        echo "Start download Nagios Client package"
        cd $SOFT_PATH
        wget http://ncu.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz
        wget
        echo "Download package finished"
}
plugins(){
        echo "Install nagios-plugins"
        cd $SOFT_PATH
        /usr/sbin/useradd -s /sbin/nologin nagios
        /bin/tar xf nagios-plugins-1.4.16.tar.gz
        cd nagios-plugins-1.4.16
        ./configure
        make && make install
        chown nagios.nagios /usr/local/nagios
        chown -R nagios.nagios /usr/local/nagios/libexec
}
nrpe(){
        echo "Install Nrpe"
        cd $SOFT_PATH
        /bin/tar xf nrpe-2.14.tar.gz
        cd nrpe-2.14
        ./configure && make all
        make install-plugin
        make install-daemon
        make install-daemon-config
        make install-xinetd
}
config(){
        echo "Config Nrpe"
        sed -i "s/yes/no/g" $XIN_NRPE_PATH
        sed -i "s/127.0.0.1/$LO_CLIENT $NG_SERVER/g" $XIN_NRPE_PATH
        echo "nrpe 5666/tcp" >> $PORT_NRPE_PATH
        /etc/init.d/xinetd start
        /etc/init.d/xinetd restart
        netstat -tnlp |grep xinetd
        echo "If you look the LISTEN 5666 port,Congtralations!Nagios-Client Install are Successful."
}
main(){
        download
        plugins
        nrpe
        config
}
main
阅读(986) | 评论(1) | 转发(0) |
0

上一篇:没有了

下一篇:nagios_server自动安装脚本

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

校长的马夹2013-03-28 10:09:45

希望可以多多分享你的技术文章