环境:
1. 数台Linux RH6 x86_64服务器需要进行load/disk space/process数量等监控
2. 其中client1/2/3 (下文c1/c2/c3)属于开发组A,client4/5(下文c4/c5)属于开发组B
准备:
1. NIS环境下创建一个nagios账户和特定的组,如nagios,属组为nagios
2. 确保需要监控的服务器全部加入NIS
3. 选取一台服务器做nagios监控服务器,假设叫Monitor
4.下载安装包:https://www.nagios.org/downloads/ 选择免费的安装包(如果是需要商用版本,需要到www.nagios.com下载)
nagios core的免费版本叫Core DIY,当前最新版本为nagios-4.1.1。下图为https://www.nagios.org/downloads/nagios-core/ 页面展示的CORE的不同免费/收费版本的对比
nagios plugin版本为2.1.1,nrpe版本为2.15.
之所以选择nrpe,而不是使用ssh方式监控客户端,是考虑到所有服务器都在内网,并且各个服务器都有很多用途,cpu占用率比较高,如果使用Nagios的check_by_ssh插件,会增加monitor和client的cpu负担(https://assets.nagios.com/downloads/nagioscore/docs/nrpe/NRPE.pdf 原话是:: It is possible to execute Nagios plugins on remote Linux/Unix machines through SSH. There is acheck_by_ssh plugin that allows you to do this. Using SSH is more secure than the NRPE addon, but it alsoimposes a larger (CPU) overhead on both the monitoring and remote machines. This can become an issue whenyou start monitoring hundreds or thousands of machines. Many Nagios admins opt for using using the NRPEaddon because of the lower load it imposes.)
Monitor服务器上的安装Nagios:
1. root登录Monitor
2. 确保Monitor上已经安装了Apache/PHP/GCC Compiler/GD development libraries
3. 把下载到的安装包, nagios-4.1.1.tar / nagios-plugins-2.1.1.tar.gz / nrpe-2.15.tar.gz放到某个目录,如/root/nagios,并解压(如 tar xzf nagios-plugins-2.1.1.tar.gz)
4. 先安装nagios (https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/quickstart.html 列出了安装的参考,但是没有针对RH的&#