可以在这个页面中看到,API测试可以将一个命令提交到Nagios用于一个或者多个host和service测试。
需要注意的是,必须输入令牌,以便能正确的访问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=
Send a passive host or service check result to a remote Nagios instance using the NRDP agent. [root@ff nrdp]# |
这就是这个客户端城程序的用法。
下面是一个向运行在192.168.3.138的IP上的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" |