ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Nagios pnp4nagios RHEL安装

Nagios pnp4nagios RHEL安装

原创 Linux操作系统 作者:tomshenhao 时间:2011-09-13 14:30:12 0 删除 编辑
 

安装前确保Nagios,check_mk均已安装,并可正常使用

1. 要求:Perl >= 5.x

检查 PERL:perl -v 

This is perl, v5.8.8 built for i386-linux-thread-multi

2. 要求:RRDtool >= 1.x, better 1.2

安装 rrdtool 

rpm perl-rrdtool-1.2.30-1.el5.rf.i386.rpm rrdtool-1.2.30-1.el5.rf.i386.rpm

检查rrdtool:rrdtool -v

RRDtool 1.2.30  Copyright 1997-2008 by Tobias Oetiker

4. 安装libxml2:yum install libxml2-devel.i386
5. 要求:PHP >= 5.1.6

[root@rhel_1 /]# php -v
PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

6. 检查配置文件:/etc/httpd/conf/httpd.conf

检查是否有:LoadModule rewrite_module modules/mod_rewrite.so

7. 安装 pnp4nagios-0.6.13.tar.gz

tar xvf pnp4nagios-0.6.13.tar.gz

./configure

make all

make install

make install-webconf

make install-config

make install-init

8. 改名文件:mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.bk

9. 打开NAGIOS.点击太阳图标,检查是否有绘图功能

10. 修改配置文件:

a. 创建配置文件

nagios $> cd /usr/local/pnp4nagios/etc
nagios $> mv misccommands.cfg-sample  misccommands.cfg
nagios $> mv nagios.cfg-sample  nagios.cfg
nagios $> mv npcd.cfg-sample npcd.cfg
nagios $> mv process_perfdata.cfg-sample  process_perfdata.cfg
nagios $> mv rra.cfg-sample rra.cfg
nagios $>  cd pages
nagios $> mv web_traffic.cfg-sample web_traffic.cfg
nagios $> cd ../check_commands
nagios $> mv check_all_local_disks.cfg-sample  check_all_local_disks.cfg
nagios $> mv check_nrpe.cfg-sample  check_nrpe.cfg
nagios $> mv check_nwstat.cfg-sample  check_nwstat.cfg

b. 重启服务

nagios $> /etc/init.d/npcd restart

c. 修改 nagios 的配置文件.打开performance_data

nagios $> cd /usr/local/nagios/etc
nagios $> vi nagios.cfg
去掉#:
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

d. 修改 commands.cfg

nagios $> cd /usr/local/nagios/etc/objects
nagios $> vi commands.cfg

将原有的定义注释掉:

# 'process-host-perfdata' command definition
#define command{
#       command_name    process-host-perfdata
#       command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
#       }


# 'process-service-perfdata' command definition
#define command{
#       command_name    process-service-perfdata
#       command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
#       }

添加新的内容:
# 'process-host-perfdata' command definition
define command{
        command_name    process-host-perfdata
        command_line    /usr/local/pnp4nagios/libexec/process_perfdata.pl
        }
# 'process-service-perfdata' command definition
define command{
        command_name    process-service-perfdata
        command_line    /usr/local/pnp4nagios/libexec/process_perfdata.pl
        }

11. 重启check_mk服务

check_mk -II

check_mk -O

12. 重启nagios服务

service nagios restart

13. 重启httpd服务

service httpd restart

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24751738/viewspace-707277/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-07-14

  • 博文量
    260
  • 访问量
    393455