免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5215 | 回复: 1
打印 上一主题 下一主题

Nagios 安装PNP(类似Cacti)绘图查看监控主机 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-04-28 19:54 |只看该作者 |倒序浏览
Nagios 安装过程请看 http://bbs.linuxtone.org/thread-2201-1-1.html 这里省略
下载pnp-0.4.13.tar.gz
tar zvxf pnp-*
cd pnp*
./configure
当显示出以下信息,就表示配置正常
*** Configuration summary for pnp 0.4.13 02-19-2009 ***
  General Options:
  -------------------------         -------------------
  Nagios user/group:                nagios nagios
  Install directory:                /usr/local/nagios
  HTML Dir:                         /usr/local/nagios/share/pnp
  Config Dir:                       /usr/local/nagios/etc/pnp
  Path to rrdtool:                  /usr/bin/rrdtool (Version 1.2.30)
  RRDs Perl Modules:                FOUND (Version 1.203)
  RRD Files stored in:              /usr/local/nagios/share/perfdata
  process_perfdata.pl Logfile:      /usr/local/nagios/var/perfdata.log
  Perfdata files (NPCD) stored in:  /usr/local/nagios/var/spool/perfdata/

make all && make install
make install-config && make install-init
  1. Nagios 2.x
  2. Until nagios 2.10 the integration of external URLs into the nagios web interface occurs using Extended Info Objects. For PNP we use the directive action_url to call the PNP web frontend with the appropriate options.
  3. define serviceextinfo {
  4. host_name localhost
  5. service_description load
  6. action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
  7. }

  8. Nagios 3.x
  9. Since nagios 3.0 the action_url-directive has be moved to the host or service definition. The objects serviceextinfo and hostextinfo do not apply anymore. This way the definition of URLs to the PNP-interface have been simplified.
  10. define host {
  11. name host-pnp
  12. register 0
  13. action_url /nagios/pnp/index.php?host=$HOSTNAME$
  14. }
  15. define service {
  16. name srv-pnp
  17. register 0
  18. action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
  19. }
复制代码


我这里安装的时nagios 3.0.6,所以要在templates.cfg 的最后添加
define host {
  name       host-pnp
  register   0
  action_url /nagios/pnp/index.php?host=$HOSTNAME$
}
define service {
  name       srv-pnp
  register   0
  action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
}

Since Nagios 3.x it is possible to deactivate the export of environment variables (as part of optimizing the system for maximum performance). Unfortunately this directive has to be enabled to use the default mode. So either you use the default value (which means that the export is enabled) or you define the variable in nagios.cfg
enable_environment_macros=1Additionally the command to process performance data is to be specified in nagios.cfg
service_perfdata_command=process-service-perfdataStarting with Nagios 3.0 it may be useful to enable processing of performance data for hosts as well. Due to changed host check logic Nagios 3 now performs regularly scheduled host checks.
host_perfdata_command=process-host-perfdata

在commands.cfg 添加一下
define command {
  command_name    process-service-perfdata
  command_line    /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl
}

define command {
  command_name    process-host-perfdata
  command_line    /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}

在一个要使用pnp监控的主机配置文件里,比如 localhost.cfg 修改以下内容
define host{
        use                     linux-server,host-pnp                                                                                                                           
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        action_url              /nagios/pnp/index.php?host=$HOSTNAME$
        process_perf_data 1
        }

define service{
        use                             local-service,srv-pnp                host_name                       localhost
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        process_perf_data 1

        }
以此类推,祝大家好运!
附上流量监控




论坛徽章:
0
2 [报告]
发表于 2011-05-09 10:17 |只看该作者
学习了  收藏先
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP