Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Extends Dropwizard's Task component to return Nagios-formatted healthchecks.

So, why not just repurpose Dropwizard's HealthCheck?

The Dropwizard (Yammer/Codahale) HealthCheck facility does not provide the granularity we desire. We really like (nay prefer) the Nagios reporting standard which not only includes four valid service states (OK, WARN, CRITICAL, UNKNOWN), but also allows the output of Perf Data (performance data), which are arbitrary metrics specific to a health check. While we get some of the same capabilities in different ways with Dropwizard's Metrics, we really want the ability to have this all integrated into one solution.

Release Notes

1.1.0 Refactored the Nagios check script to be more idiomatic. Fixed a couple of warts in the model that was representative of the old JSendNSCA project.

1.0.1 Fixed a dependency issue that was causing the build to fail.


Access via Maven:

    <name>Berico Technologies Nexus</name>


Installing the Nagios Check Plugin:

  1. Install the Python dependencies: pynag and requests:
sudo pip install requests
sudo pip install pynag


Writing a Nagios HealthCheck in Java

To write a Nagios HealthCheck in Java, simply extend the com.bericotech.dropwizard.nagios.NagiosCheckTask class:

public class ExampleNagiosCheckTask extends NagiosCheckTask {

    public DemoCheckTask() {


    public MessagePayload performCheck(ImmutableMultimap<String, String> requestParameters) throws Throwable {

        return MessagePayload
                .withMessage("Everything is OK!")
                    PerfDatum.builder("sproketCount", 42).build()

There is a more detailed example here: src/test/java/com/bericotech/dropwizard/nagios/

Adding Nagios HealthChecks to Dropwizard.

NagiosCheckTasks are Dropwizard Tasks. Therefore, they are added the same way. Simply all environment.addTask(nagiosCheckTask); to add it to the Dropwizard runtime.

For example, if we created a custom bundle:

public class ExampleNagiosBundle implements Bundle {

    public void initialize(Bootstrap<?> bootstrap) {}

    public void run(Environment environment) {

        environment.addTask(new ExampleNagiosCheckTask());

This example can be found here: src/test/java/com/bericotech/dropwizard/nagios/

Creating the Check Task in Nagios.

Add the to the Nagios/Icinga plugin directory.

To get all of the options to, execute: python --help.

A simple example is found in the integration tests: PassingTask:

python -u admin -p admin -H localhost -P 11112 -U tasks/passing-task?param1=value

Which returns:

OK - success

Parameters should be added to the relative path parameter -U. These parameters will be made available to the task in as entries in the ImmutableMultimap<String, String> passed to all NagiosCheckTask instances.

For example, in the integration tests, there is a task called ParameterizedTask. This can be executed against a locally launched Dropwizard instance like so:

python -u admin -p admin -H localhost -P 11112 -U 'tasks/parameterized-task?p1=value1&p2=value2'

Which returns:

OK - success w/ p1=value1 and p2=value2

Please take note of the use of quotes for the parameters. If you do not, the text after the ampersand (&) will be interpreted by BASH as a separate command.

Contributions and Legal Information


Some of the code is borrowed from the JSENDNSCA project written by Raj.Patel (


This project is licensed under the Apache Software Foundation's License 2.0.

The MessagePayload, MessagePayloadBuilder, Level have been partially rewritten from the JSendNSCA library, which is also licensed Apache 2.0.


Nagios status checks via Dropwizard Admin HTTP port.



You can’t perform that action at this time.