NAGIOS服务端安装
一、 主软件包:
1. nagios-3.0.x.tar.gz 主程序
2. nagios-plugins-1.4.x.tar.gz 插件
3. nrpe_2.8.x.tar.gz 外部构件
4. pnp -0.4.X 图形化工具
二、基本安装:
软件包准备:
服务端安装:
rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel httpd
安装步骤:
2.1 建立账号:
useradd nagios
passwd nagios
usermod -G nagios nagios
usermod -G nagios apache
2.2 安装nagios-3.0.x.tar.gz
./configure (不用跟参数, 默认安装在/usr/local/nagios)
配置完毕按照提示安装
make all
====================
make install
====================
make install-init
====================
make install-config
====================
make install-commandmode
====================
make install-webconf #针对rpm版apache, source包apache配置见下 ====================
设置收信人地址
vi /usr/local/nagios/etc/objects/contacts.cfg
更改email地址nagiosadmin的联系人定义信息中的EMail信息为你的EMail信息以接收报警内容.
/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd nagiosadmin
输入密码(这一步很重要)
2.3安装Nagios插件
2.3.1 nagios-plugins-1.4.X.tar.gz
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install
chkconfig –add nagios
chkconfig nagios on
2.3.2 nrpe_2.8.x.tar.gz
./configure
make all
make install-plugins
make install-daemon
make install-daemon-config
make install-xinetd
三、 详细配置:
3.1 主机定义:
vi /usr/local/nagios/etc/objects/hosts.cfg
基本模板:
define host{
use linux-server # nagios server-name
host_name 主机名
alias 别名
address X.X.X
}
例:
define host {
host_name CentOS
use linux-server,host-pnp
alias nagios server
address 192.168.1.44
contact_groups nagcmd
check_command check-host-alive
max_check_attempts 5
notification_interval 10
notification_period 24×7
notification_options d,u,r
}
3.2 主机组定义:
vi /usr/local/nagios/etc/objects/hostgroup.cfg
基本模板:
define hostgroup{
hostgroup_name 组名
alias PAY-web
members 主机名1, 主机名2 # 须是定义过的
}
3.3 服务定义:
define service{
use generic-service ; Name of service template to use
hostgroup_name 主机组1, 主机组2
service_description Swap Usage
check_command check_nrpe!check_swap
}
例:define service {
host_name CentOS
use local-service,srv-pnp
【nagios监控服务器 安装配置方法】service_description CPU
check_period 24×7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups nagcmd
notification_interval 10
notification_period 24×7
notification_options w,u,c,r
check_command check_nrpe!check_cpu
}
四、 NAGIOS的图形化(PNP)
#基于LAMP平台
PNP 是基于PHP和PERL, 利用rrdtool将Nagios采集的数据绘制成图表
软件包列表:
Perl
rrdtool 1.2.*
pnp-0.3.3.tar.gz
4.1 安装rrdtool-1.4.4.*
tar –xvf rrdtool-1.4.4*
./configure 进行配置 –-prefix=/usr/local/rrdtool
make;make install 然后再编译和安装
ls /usr/local/rrdtool-1.4.4.* 查看安装目录是否有

文章插图
特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
