简体   繁体   English

使用PHP从Nagios获取(原始)数据(?)

[英]Get (raw) data from Nagios using PHP (?)

I am looking into Nagios, and after checking their web site i came across 2 APIs in PHP for fetching/reading data from Nagios. 我正在研究Nagios,在检查了他们的网站之后,我遇到了2个PHP API,用于从Nagios读取/读取数据。

  • sourceforge.net/projects/gwfoundation/ sourceforge.net/projects/gwfoundation/
  • naupy.sourceforge.net/ naupy.sourceforge.net/

Do you happen to know any other similar solutions (apis) in PHP which allow parsing/fetching of data generated by Nagios? 您是否碰巧知道PHP中有其他类似的解决方案(api),它们可以解析/获取Nagios生成的数据?

Looking for anything written in PHP so if you know something, or have something to recommend, please do tell :) 寻找任何用PHP编写的内容,因此,如果您了解或推荐一些东西,请告诉:)

Use Nagios::Report to retrieve information from avail.cgi 使用Nagios :: Reportavail.cgi检索信息

It is included with a lot of examples. 它包含了很多示例。

If all you're interested is getting basic status information, you can just use PHP's preg_match_all to parse nagios' status file pretty easily and get what you want. 如果您只想获取基本的状态信息,则可以使用PHP的preg_match_all轻松解析nagios的状态文件并获得所需的信息。 Just create the regex to match whatever fields you're interested in and you can do whatever you want. 只需创建正则表达式以匹配您感兴趣的任何字段,您就可以做任何您想做的事情。 If you want a simple example let me know and I can hack one up. 如果您想举一个简单的例子,请告诉我,我可以举一个例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM