服务器监控-Nagios安装篇


一:安装前准备

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可以和被监控端正常通信

安装完毕,接下来开始配置。见

网络监控器Nagios全攻略

Nagios搭建与配置详解

Nginx环境下构建Nagios监控平台

在RHEL5.3上配置基本的Nagios系统(使用Nagios-3.1.2)

CentOS 5.5+Nginx+Nagios监控端和被控端安装配置指南

Ubuntu 13.10 Server 安装 Nagios Core 网络监控运用

Nagios 的详细介绍:请点这里
Nagios 的下载地址:请点这里

本文永久更新链接地址:

相关内容