shell脚本安装nagios客户端-创新互联
#!/bin/bash
/etc/init.d/iptables stop
setenforce 0
rm -rf /usr/local/nagios/*
echo "=========================下载nrpe"
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
echo "=========================下载nagios插件"
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
echo "安装nagios插件开始..................."
/usr/sbin/useradd nagios
tar zxvf 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
if [ "$?" -eq "0" ] ;then
echo "安装nagios插件完成.................."
else echo "安装nagios插件失败............."
fi
sleep 5
cd ..
echo "安装nrpe开始........................."
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure && make all && make install-plugin && make install-daemon && make install-daemon-config
if [ "$?" -eq "0" ] ;then
echo "安装nrpe完成.................."
else echo "安装nrpe失败............."
fi
rm -rf nagios-plugins-1.4.16* nrpe-2.13*
此处根据实际情况修改nagios服务器IP
sed -i '/allowed_hosts/s/127.0.0.1/192.168.100.41/' /usr/local/nagios/etc/nrpe.cfg
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
netstat -nptl |grep 5666
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
文章名称:shell脚本安装nagios客户端-创新互联
转载源于:http://myzitong.com/article/csdgoj.html