No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

local-monitors interface

Use this interface to register nagios checks in your charm layers.


This interface is designed to interoperate with the nrpe subordinate charm.

How to use in your layers

The event handler for local-monitors.available is called with an object through which you can register your own custom nagios checks, when a relation is established with nrpe:local-monitors.

This object provides a method,

add_check(args, name=check_name, description=description, context=context, unit=unit)

which is called to register a nagios plugin check for your service.

All arguments are required.

args is a list of nagios plugin command line arguments, starting with the path to the plugin executable.

name is the name of the check registered in nagios

description is some text that describes what the check is for and what it does

context is the nagios context name, something that identifies your application

unit is hookenv.local_unit()

The nrpe subordinate installs check_http, so you can use it like this:

def setup_nagios(nagios):
    config = hookenv.config()
    unit_name = hookenv.local_unit()
            '-I', '', '-p', str(config['port']),
            '-e', " 200 OK", '-u', '/publickey'],
        description="Verify my awesome service is responding",

Consult the nagios documentation for more information on how to write your own plugins or find one that does what you need.

Example deployment

$ juju deploy your-awesome-charm
$ juju deploy nrpe
$ juju deploy nagios
$ juju add-relation your-awesome-charm nrpe:local-monitors
$ juju add-relation nrpe nagios

Sign in to the deployed nagios web interface, and you should see your registered nagios checks.