it.jnrpe.client
Class JNRPEClient

java.lang.Object
  extended by it.jnrpe.client.JNRPEClient

public class JNRPEClient
extends Object

This class represent a simple JNRPE client that can be used to invoke commands installed inside JNRPE by code. It is the JAVA equivalent of check_nrpe.

Author:
Massimiliano Ziccardi

Constructor Summary
JNRPEClient(String sJNRPEServerIP, int iJNRPEServerPort, boolean bSSL)
          Instantiates a JNRPE client.
 
Method Summary
 int getTimeout()
          Returns the currently configured connection timeout in seconds
static void main(String[] args)
           
 it.jnrpe.ReturnValue sendCommand(String sCommandName, String... arguments)
          Inovoke a command installed in JNRPE.
 void setTimeout(int iTimeout)
          Sets the connection timeout in seconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JNRPEClient

public JNRPEClient(String sJNRPEServerIP,
                   int iJNRPEServerPort,
                   boolean bSSL)
Instantiates a JNRPE client.

Parameters:
sJNRPEServerIP - The IP where the JNRPE is installed
iJNRPEServerPort - The port where the JNRPE server listens
Method Detail

sendCommand

public it.jnrpe.ReturnValue sendCommand(String sCommandName,
                                        String... arguments)
                                 throws JNRPEClientException
Inovoke a command installed in JNRPE.

Parameters:
sCommandName - The name of the command to be invoked
arguments - The arguments to pass to the command (will substitute the $ARGSx$ parameters)
Returns:
The value returned by the server
Throws:
JNRPEClientException - Thrown on any communication error.

setTimeout

public void setTimeout(int iTimeout)
Sets the connection timeout in seconds

Parameters:
iTimeout - The new connection timeout. Default : 10

getTimeout

public int getTimeout()
Returns the currently configured connection timeout in seconds

Returns:
The connection timeout

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2013. All Rights Reserved.