简体   繁体   English

NRPE协议说明

[英]NRPE Protocol description

I need to query a nrpe nagios server from a Java application remotely just as check_nrpe would do: 我需要从Java应用程序远程查询nrpe nagios服务器,就像check_nrpe那样:

check_nrpe -H 192.***.***.*** -p 56** -c "check_load"

When I say "from a Java application" I mean I want the results to be received and processed at my Java application. 当我说“来自Java应用程序”时,我的意思是我希望在Java应用程序中接收并处理结果。 The first idea I had was to call the "check_nrpe" command from my application and retrieve its output and return value but I would like more a standalone solution where no external programs are called. 我的第一个想法是从应用程序中调用“ check_nrpe”命令并检索其输出和返回值,但我希望有一个独立的解决方案,其中不调用任何外部程序。

I don't need to wait for state changes, just eventually check the monitor state. 我不需要等待状态更改,只需要最终检查监视器状态即可。 Since I have been unable to locate any Java library (should I try JNRPE?), I would like to implement the protocol check_nrpe and nrpe daemon use to communicate. 由于我无法找到任何Java库(我应该尝试JNRPE吗?),因此我想实现用于通信的check_nrpenrpe守护程序协议。

Have any of you tried this before? 你们有没有尝试过这个? In that case, do you have a description of this protocol? 在这种情况下,您是否对此协议有描述?

If your answers are negative I will try to analize the protocol using whireshark but any clue will be much appreciated. 如果您的回答是否定的,我将尝试使用whireshark对协议进行分析,但是任何线索将不胜感激。

An explanation of NRPE protocol from Andreas Marschke blog, The NRPE Protocol explained (on gitHub too) 来自Andreas Marschke博客的NRPE协议说明 ,也解释了NRPE协议 (也在gitHub上

Anyway, JNRPE have a full working implementation of the protocol, you can download jcheck_nrpe-2.0.3-RC5 source code and take a look at jcheck_nrpe-2.0.3-RC5\\src\\main\\java\\it\\jnrpe\\client\\JNRPEClient.java class for a sample client who's using jnrpe-lib-1.0.1-RC5 . 无论如何, JNRPE具有该协议的完整工作实现,您可以下载jcheck_nrpe-2.0.3-RC5源代码,并查看jcheck_nrpe-2.0.3-RC5\\src\\main\\java\\it\\jnrpe\\client\\JNRPEClient.java类,用于使用jnrpe-lib-1.0.1-RC5的示例客户端。

jnrpe-lib have two concrete classes which implements the protocol request and response jnrpe-lib有两个具体的类,它们实现协议请求和响应

  • JNRPERequest.java JNRPERequest.java
  • JNRPEResponse.java JNRPEResponse.java

The full protocol implementation classes can be found at jnrpe-lib-1.0.1-RC5\\src\\main\\java\\it\\jnrpe\\net\\ folder 完整的协议实现类可以在jnrpe-lib-1.0.1-RC5\\src\\main\\java\\it\\jnrpe\\net\\文件夹中找到

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

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