服务器监控-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)