PNP4NAGIOS使用NPCD的Bulk模式下的设置

PNP4NAGIOS怎么安装自己网上找吧,懒得整理了

首先编辑/usr/local/nagios/etc/nagios.cfg文件,在文件中添加
 
 
process_performance_data=1
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file

#
# host performance data starting with Nagios 3.0
# 
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file

其次编辑/usr/local/nagios/etc/objects/commands.cfg,添加以下配置
define command{
       command_name    process-service-perfdata-file
       command_line    /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}

define command{
       command_name    process-host-perfdata-file
       command_line    /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}

Using these commands the file service-perfdata will be moved to var/spool/ after the interval specified in service_perfdata_file_processing_interval has passed. The Nagios macro $TIMET$ is appended to the filename to avoid overwriting of old files unintentionally. The macro $TIMET$ contains the current timestamp in time_t format (seconds since the UNIX epoch).

In the directory /usr/local/pnp4nagios/var/spool/ files are gathered to be processed by NPCD.

NPCD monitors the spool directory and passes the file names to process_perfdata.pl. This way processing of performance data is completely decoupled from nagios.

Before starting NPCD you have to check the paths to the spool directory and to process_perfdata.pl specified in the config file  npcd.cfg. The only thing that remains is to start NPCD.


 /usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg

第三,在/usr/local/nagios/etc/objects/templates.cfg中添加定义host和service模板:
define host {
        name            host-pnp
        action_url      /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
        register        0
        }

define service {
        name            srv-pnp
        action_url      /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
        register        0
        }

最后,在需要查看图像化的host和service定义中添加第三步定义的模板
在hosts.cfg中添加use host-pnp,generic-host
service.cfg 添加 use srv-pnp,generic-service

vi hosts.cfg
define host{
        use                             generic-host,host-pnp
        host_name                       gc1
        alias                           gc1
        address                         192.168.10.150
        check_command                   check-host-alive
        max_check_attempts              5
        check_period                    24x7
        contact_groups                  admins
        notification_interval           10
        notification_period             24x7
        notification_options            d,u,r
        }

define host{
        use                             generic-host,host-pnp
        host_name                       gc2
        alias                           gc2
        address                         192.168.10.152
        check_command                   check-host-alive
        max_check_attempts              5
        check_period                    24x7
        contact_groups                  admins
        notification_interval           10
        notification_period             24x7
        notification_options            d,u,r
        }

vi services.cfg
define service{
        use                     generic-service,srv-pnp
        host_name               gc2
        service_description     check-host-alive
        check_command           check-host-alive
        max_check_attempts      5
        normal_check_interval   3
        retry_check_interval    2
        check_period            24x7
        notification_interval   10
        notification_period     24x7
        notification_options    w,u,c,r
        contact_groups          admins
        }




define service{
        use                     generic-service,srv-pnp
        host_name               gc2
        service_description     Swap_Usage
        check_command           check_nrpe!check_swap
        max_check_attempts      5
        normal_check_interval   3
        retry_check_interval    2
        check_period            24x7
        notification_interval   10
        notification_period     24x7
        notification_options    w,u,c,r
        contact_groups          admins
        }

访问web

点击
若出现如下:


按照提示mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.bak

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值