Ubuntu Pastebin

Paste from vds at Wed, 19 Jul 2017 16:02:45 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from charms.reactive import (
    when,
    when_not,
    set_state)


from charmhelpers.core import hookenv


@when_not('testme.installed')
def install_testme():
    set_state('testme.installed')


@when_not('testme.ready')
def status_testme():
    hookenv.status_set('active', 'ready')
    set_state('testme.ready')


@when('local-monitors.available')
def setup_nagios(nagios):
    hookenv.status_set('maintenance', 'Creating Nagios check')
    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,)
Download as text