nagios core 4.4.1升级 4.4.3
2019-05-30
Nagios Core provides the central monitoring engine and a web interface for viewing current status, historical logs, and basic reports.
nagios每隔一段时间就会有新版本,会提供新功能也会修复bug.注意升级会覆盖原来的配置。
1、下载
https://www.nagios.org/downloads/nagios-core/thanks/?t=1426844202
2019-01-15 Latest stable release
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.3.tar.gz
2017-04-19 Latest stable release
wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
2017-09-01 Last Release Date
https://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz
https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz
2、如果第一次安装nagios需要创建user和group
#!/bin/bash
/usr/sbin/useradd -m nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd www
export NAGIOS=/opt/nagios
cd $NAGIOS
3、安装
tar zxf untar/nagios-4.4.3.tar.gz
pushd nagios-4.4.3
./configure --prefix=/usr/local/nagios --with-command-group=nagcmd
make all;
make install 安装主程序和share页面
make install-init 安装/etc/init.d/nagios
make install-commandmode
make install-config 这步骤不需要
popd
4、vi ins_nrpe.sh
#!/bin/sh
today=`date +%Y%m%d%H%M`
VER=`uname -r|awk -F\. '{print $6}'`
yum -y install xinetd openssl-devel
sed -i '/nagios/d' /etc/passwd
sed -i '/nagios/d' /etc/group
/usr/sbin/useradd -s /sbin/nologin -d /usr/local/nagios nagios
tar zxf nagios-plugins-2.2.1.tar.gz
pushd nagios-plugins-2.2.1
./configure && make && make install
popd
chown nagios.nagios /usr/local/nagios && chown -R nagios.nagios /usr/local/nagios/libexec
if [ -f /usr/local/nagios/etc/nrpe.cfg ];then
/bin/cp -f /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg_$today
fi
tar zxf nrpe-3.2.1.tar.gz
pushd nrpe-3.2.1
./configure && make all && make install-plugin && make install-daemon && make install-config
popd
sed -i '/nrpe/d' /etc/services
cat >> /etc/services << !
nrpe 5666/tcp # nrpe
!
/bin/cp -f nrpe /etc/xinetd.d
sed -i '/^command/d' /usr/local/nagios/etc/nrpe.cfg
sed -i '/hardcoded/r nrpe.txt' /usr/local/nagios/etc/nrpe.cfg
case "$VER" in
el4|el5|el6)
/etc/init.d/xinetd restart && exit 0
;;
el7)
systemctl enable xinetd && systemctl start xinetd && exit 0
;;
*)
exit 2
esac
~
分类:Linux | 标签: |
相关日志