#!/bin/bash

yum install make gcc glibc glibc-common gd gd-devel openssl-devel -y

/usr/sbin/useradd  nagios

tar xzf /root/nagios-plugins-1.4.16.tar.gz

cd nagios-plugins-1.4.16

./configure    --prefix=/usr/local/nagios

make

make install

chown -R nagios.nagios /usr/local/nagios

/bin/tar -xzf /root/nrpe-2.13.tar.gz -C /root/

cd /root/nrpe-2.13

./configure

/usr/bin/make all && echo "make all succeed" || "make all failed"

/usr/bin/make install-plugin && echo "install-plugin succeed"  || echo "install plugin failed"

/usr/bin/make install-daemon && echo "install-daemon succeed" || echo "install-daemon failed"

/usr/bin/make install-daemon-config && echo "install-daemon-config succeed" || echo "install-daemon-config failed"

sed -i s/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,172.16.10.50/g  /usr/local/nagios/etc/nrpe.cfg

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" /etc/rc.local

echo "All the staff have been finished! Come on !"

简单的脚本文件,待更多完善。需要163镜像的yum 安装环境。在根下拷贝nagios-plugins-1.4.16.tar.gz及nrpe-2.13.tar.gz这两个文件。其他经本人在虚拟机测试可行!