NRDP要比NSCA更好使用 2

   可以在这个页面中看到,API测试可以将一个命令提交到Nagios用于一个或者多个hostservice测试。

 

    需要注意的是,必须输入令牌,以便能正确的访问API,这里了使用的API是在NRDP

 

使用NRDP客户端

 

    NRDP插件的发布中包含了一个基本的客户端,在NRDP安装之后,可以找到一个文件名为send_nrdp.php的客户端:

 

[root@slave nrdp]# tree

.

|-- CHANGES.TXT

|-- INSTALL.TXT

|-- LICENSE.TXT

|-- clients

|   `-- send_nrdp.php

|-- install-html

|-- nrdp.conf

`-- server

    |-- config.inc.php

    |-- includes

    |   |-- constants.inc.php

    |   `-- utils.inc.php

    |-- index.php

    `-- plugins

        |-- nagioscorecmd

        |   `-- nagioscorecmd.inc.php

        `-- nagioscorepassivecheck

            `-- nagioscorepassivecheck.inc.php

 

6 directories, 12 files

[root@slave nrdp]#

   

    可以将这个独立的客户分散到远程的Linux服务器,就是你想提交检测结果或者是发送命令的服务器,需要说的一点是(其实也是很明显!)这个客户端运行需要PHP环境,也就是说要在运行这个客户端的服务器上安装PHP解释器。

 

    可以不使用任何参数来执行这个客户端程序:

 

[root@ff nrdp]# php clients/send_nrdp.php

send_nrdp - NRDP Host and Service Check Client

Copyright (c) 2010-2011 Nagios Enterprises, LLC

Portions Copyright (c) others - see source code

License: BSD

 

Usage: clients/send_nrdp.php --url= --token= --host= [--service=] --state= --output=

 

            = The URL used to access the remote NRDP agent.

          = The secret token used to access the remote NRDP agent.

       = The name of the host associated with the passive host/service check result.

   = For service checks, the name of the service associated with the passive check result.

          = An integer indicating the current state of the host or service.

         = Text output to be sent as the passive check result.  Newlines should be encoded with encoded newlines (\n).

 

Send a passive host or service check result to a remote Nagios instance using the NRDP agent.

[root@ff nrdp]#

   

    这就是这个客户端城程序的用法。

 

    下面是一个向运行在192.168.3.138IP上的NRDP 服务发送被动检测结果:

 

[root@x ~]# php send_nrdp.php  --url=http://192.168.3.138/nrdp --token=111111 --host=192.168.3.199 --service=ssh  --state=0 --output="The service looks okay"

   

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

转载于:http://blog.itpub.net/27043155/viewspace-733098/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值