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"

   

请使用浏览器的分享功能分享到微信等