Getting Started

Embedding the jcheck_nrpe library your application will be able to send queries to both the NRPE and the JNRPE server.

The library is published in the Maven Central repository. To link your code to jcheck_nrpe, add the following to your pom.xml:

    <dependency>
        <groupId>net.sf.jnrpe</groupId>
        <artifactId>jcheck_nrpe</artifactId>
        <version>2.0.5</version>
    </dependency>

Using jcheck_nrpe is very simple. Suppose you’d like to execute the following command:

    ./check_nrpe -n -H 127.0.0.1 -c runTest -a random1 33:66 67:

That command means that JNRPE is listening on the default port (5666) on the address 127.0.0.1 without SSL (-n) and we want to run the command ‘runTest’ passing the parameters ‘random1’, 33:66 and 67:.

The same command using the code would be:

    JNRPEClient client = new JNRPEClient("127.0.0.1", 5666, false);
    ReturnValue ret = client.sendCommand("runTest", "-a", "random1", "33:66", "67:");

The ReturnValue class will contain the return code, the returned messages and, optionally, the returned performance data.