Coder Social home page Coder Social logo

nrpe-external-master-interface's Introduction

nrpe-external-master interface

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

Purpose

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

How to use in your layers

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

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:

@when('nrpe-external-master.available')
def setup_nagios(nagios):
    config = hookenv.config()
    unit_name = hookenv.local_unit()
    nagios.add_check(['/usr/lib/nagios/plugins/check_http',
            '-I', '127.0.0.1', '-p', str(config['port']),
            '-e', " 200 OK", '-u', '/publickey'],
        name="check_http",
        description="Verify my awesome service is responding",
        context=config["nagios_context"],
        unit=unit_name,
    )

If your nagios.add_check defines a custom plugin, you will also need to restart the nagios-nrpe-server service.

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-external-master --config site-nagios.yaml
$ juju add-relation your-awesome-charm nrpe-external-master

where site-nagios.yaml has the necessary configuration settings for the subordinate to connect to nagios.

nrpe-external-master-interface's People

Contributors

cmars avatar kwmonroe avatar squidsoup avatar thomir avatar verterok avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.