共计 2438 个字符,预计需要花费 7 分钟才能阅读完成。
一:安装前准备
nagios server:192.168.1.10
nagios client:192.168.1.11
本文安装 Nagios 只使用 Nagios 邮件报警功能,如需画图另外安装 cacti,或其他插件。
二:安装服务
在 nagios server 上操作:
安装 Apache+php
yum install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml gcc glibc glibc-common gd gd-devel openssl openssl-devel
groupadd nagios
useradd nagios
useradd -G nagios nagios
usermod -G nagios apache
wget http://sourceforge.net/projects/nagios/?source=directory
tar zxvf nagios-3.2.0.tar.gz
cd nagios-3.2.0
./configure –prefix=/usr/local/nagios –with-command-group=nagios
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart
nagios-plugins 下载地址:www.nagios.org
tar zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-nagios-group=nagios
make && make install
wget http://sourceforge.net/projects/nagios-cn/files/latest/download
tar -xjf nagios-cn-3.2.3.tar.bz2
cd nagios-cn-3.2.3
./configure
make all
make install
http://sourceforge.net/projects/nagios/files/nrpe-2.x/
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure
make all
make install-plugin
vi /usr/local/nagios/etc/objects/commands.cfg 在最后添加
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
检查配置文件是否正确
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
在被监控主机上操作:
useradd -s /sbin/nologin nagios
tar zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-nagios-group=nagios
make && make install
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
yum install xinetd
vim /etc/xinetd.d/nrpe
将 only_from = 后面加上监控端的地址:192.168.1.10
确保 /etc/services 有 nrpe 5666/tcp #NRPE 这一行,没有则添加
重启 xinetd 服务,至此被监控端配置完毕
/usr/local/nagios/libexec/check_nrpe -H 被监控端的地址
如能显示“NRPE v2.12”,表明 NRPE 可以和被监控端正常通信
安装完毕,接下来开始配置。见 http://www.linuxidc.com/Linux/2014-10/108525.htm
网络监控器 Nagios 全攻略 http://www.linuxidc.com/Linux/2013-07/87067.htm
Nagios 搭建与配置详解 http://www.linuxidc.com/Linux/2013-05/84848.htm
Nginx 环境下构建 Nagios 监控平台 http://www.linuxidc.com/Linux/2011-07/38112.htm
在 RHEL5.3 上配置基本的 Nagios 系统 (使用 Nagios-3.1.2) http://www.linuxidc.com/Linux/2011-07/38129.htm
CentOS 5.5+Nginx+Nagios 监控端和被控端安装配置指南 http://www.linuxidc.com/Linux/2011-09/44018.htm
Ubuntu 13.10 Server 安装 Nagios Core 网络监控运用 http://www.linuxidc.com/Linux/2013-11/93047.htm
Nagios 的详细介绍 :请点这里
Nagios 的下载地址 :请点这里