#!/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
阅读(1021) | 评论(1) | 转发(0) |