网络通信 频道

实战经验:nagios 3.X pnp-0.4.3 配置小记

  安装完所有的软件后需要做一些配置。
  1.修改PNP配置文件,开启日志
  默认路径在:/usr/local/nagios/var/process_perfdata.cfg
  LOG_FILE = /usr/local/nagios/var/perfdata.log
  #
  # Loglevel 0=silent 1=normal 2=debug
  #
  LOG_LEVEL = 0   #本例设置为2 使用debug模式

  2、修改nagios配置文件
  参照官网:http://www.pnp4nagios.org/pnp/webfe
  本例3.X有一个小区别就是加太阳图标的时候
  是在/usr/local/nagios/etc/objects/templates.cfg    server选项及local选项,添加红色部分
  -----------------------------------------------------------
  define service{
  name                            generic-service
  action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
  process_perf_data               1


  define service{
  name                            local-service
  use                             generic-service
  action_url /nagios/pnp/index.php?host=$HOSTNAME$
  process_perf_data               1
  -----------------------------------------------------------

  3、修改nagios.cfg 主配置文件
  找到如下几项,去掉注释
  process_performance_data=1
  host_perfdata_command=process-host-perfdata
  service_perfdata_command=process-service-perfdata

  4、修改command.cfg 配置文件
  修改成如下配置

  # '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
  #             }
  define command {
  command_name    process-service-perfdata
  command_line    /usr/local/nagios/libexec/process_perfdata.pl
  }

0
相关文章