Chinaunix首页 | 论坛 | 博客

rgy

  • 博客访问: 427318
  • 博文数量: 179
  • 博客积分: 2580
  • 博客等级: 少校
  • 技术积分: 1890
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-19 08:45
文章分类

全部博文(179)

文章存档

2012年(7)

2011年(43)

2010年(60)

2009年(69)

我的朋友

分类:

2009-06-05 15:56:40


 在安装pnp-nagios之前应该安装
   php
   rrdtool
apt-get install php5
apt-get install rrdtool
apt-get install php5-gd
tar -zxvf pnp-04.4.14.tar.gz
cd pnp**
./configure --prefix=/etc/nagios3/
*** Configuration summary for pnp 0.4.13 02-19-2009 ***
  General Options:
  -------------------------         -------------------
  Nagios user/group:                nagios nagios
  Install directory:                /etc/nagios3
  HTML Dir:                         /etc/nagios3/share/pnp
  Config Dir:                       /etc/nagios3/etc/pnp
  Path to rrdtool:                  /usr/bin/rrdtool (Version 1.2.23)
  RRDs Perl Modules:                FOUND (Version 1.2023)
  RRD Files stored in:              /etc/nagios3/share/perfdata
  process_perfdata.pl Logfile:      /etc/nagios3/var/perfdata.log
  Perfdata files (NPCD) stored in:  /etc/nagios3/var/spool/perfdata/
make all
make install
make install-config
make install-init
cp /etc/nagios3/etc/process_perfdata.cfg-sample /etc/nagios3/et/process_perfdata.cfg
vi /etc/nagios3/etc/process_perfdata.cfg
     修改
    LOG_LEVEL=2
修改  nagios.cfg文件
      将process_performance_data=1 改为1
       service_perfdata_command=process-service-perfdata
       host_perfdata_command=process-host-perfdata
        将注示去除

修改commands.cfg
# 'process-host-perfdata' command definition
define command{
#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
command_line /etc/nagiso3/libexec/process_perfdata.pl 注示上面的行,添加下面的内容
 command_name process-host-perfdata
}
 
# '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
注示上面的行添,加下面的内容
command_line /etc/nagios3/libexec/process_perfdata.pl
}
 
修改/etc/nagios3/conf.d/generic-service_nagios2.cfg

添加如下内容
      
      define service{
      name               srv-pnp
      register           0
      action_url         /nagios3/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$' onmouseover="get_g('$HOSTNAME$','$SERVICEDESC$')" onmouseout="clear_g()"
}

修改/etc/nagios3/conf.d/generic-host_nagios2.cfg
 添加如下内容
   define host{
                name                    host-pnp
                register                0
                action_url              /nagios3/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$' onmouseover="get_g('$HOSTNAME$','$SERVICEDESC$')" onmouseout="clear_g()"
                          }
 
 
      在/etc/apache2/conf.d/nagios3.conf 中添加如下内容
        
     Alias /nagios3/pnp         /etc/nagios3/share
修改 localhost.cfg
 

define host{
        use                     generic-host,srv-pnp        ; Name of host template to use
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        }
# Define a service to check the disk space of the root partition
# on the local machine.  Warning if < 20% free, critical if
# < 10% free space on partition.
define service{
        use                             generic-service,srv-pnp      ; Name of service template to use
        host_name                       localhost
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }
   还须要修改一下权限
                  chmod -R 777 /etc/nagios3/var 或 chown -R nagios:nagios /etc/nagios3/var
                  chmod -R 777 /etc/nagios3/share/perfdata 或 chown -R nagios:nagios: /etc/nagios3/share/perfdata
 
测试
重启 apache2 nagios3
http://****/nagios3/pnp
 
 
 
阅读(805) | 评论(0) | 转发(0) |
0

上一篇:d

下一篇:rrdtool ntop

给主人留下些什么吧!~~