nagios安装脚本

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz
wget http://jaist.dl.sourceforge.net/project/nagios-cn/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
yum -y  install  gcc  gcc*  gd gd-devel libpng libpng-devel libjpeg libjpeg-devel zlib zlib-devel httpd php php-devel
yum install openssl*  -y
useradd nagios
usermod -G nagios apache
tar zxvf nagios-3.5.1.tar.gz
cd nagios
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
chkconfig nagios on
cd ..
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --prefix=/usr/local/nagios
make && make install
cd ..
 tar jxvf nagios-cn-3.2.3.tar.bz2
cd nagios-cn-3.2.3
./configure --prefix=/usr/local/nagios/
make all
make install
cd ..
sed -i '1043 s/^/#/'  /usr/local/nagios/etc/nagios.cfg
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/etc/init.d/nagios restart
/etc/init.d/httpd restart

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --prefix= /usr/local/nagios
make  all &&   make install-plugin  && make install-daemon  && make install-daemon-config && make install-xinetd
cd ..
echo "nrpe                    5666/tcp                 #nrpe"  >> /etc/services

 

nrpe -c   /etc/nrpe.cfg -d