~verterok/charms/trusty/conn-check/add-missing-charm-helper-module

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Overview

[conn-check](https://launchpad.net/conn-check) is a utility for performing network connection
verification checks against deployed environments.

This charm handles installing conn-check and providing a configuration via a relation so
that YAML can be automatically handed off to conn-check, e.g. from
[conn-check-configs](https://launchpad.net/~ubuntuone-hackers/conn-check/configs).

The charm also provides the relation required by the [NRPE](http://manage.jujucharms.com/charms/precise/nrpe)
charm and so can be used with Nagios to run regular checks.


## Usage

Deploy your application and the subordinate:

    juju deploy myapp
    juju deploy conn-check

Relate them together to install conn-check on the `myapp` unit(s):

    juju add-relation myapp conn-check

This will install conn-check from a [launchpad branch](https://code.launchpad.net/~ubuntuone-hackers/conn-check/wheels)
of known good [wheel](http://wheel.readthedocs.org/) dependencies.

You can also specify a revno (to avoid compatibility changes from always tracking `HEAD`):

    # Will install from tag conn-check-r86 on lp:~ubuntuone-hackers/conn-check/wheels
    juju set conn-check revision=86


## Configuring your charm to support conn-check

Your charm needs to do 2 things to provide conn-check configuration YAML
to the subordinate to run tests:

 1. Provide the `conn-check` relation (interface `conn-check`)
 2. Provide a `conn-check-relation-joined` hook which sets the `config_path` value on the relation
    pointing to a file containing YAML checks (see the conn-check readme for more details on checks).


## Configuring as a Nagios check

To use your conn-check config as a regular Nagios check, just relate the conn-check
subordinate to the NRPE subordinate:

    # Nagios master to report back to
    juju deploy nagios central-monitor

    # Add the local Nagios monitor to your service
    juju deploy nrpe myapp-nrpe
    juju add-relation myapp myapp-nrpe

    # Now tell the Nagios subordinate to run checks with conn-check
    juju add-relation myapp-nrpe conn-check

    # And report back to the master
    juju add-relation myapp-nrpe central-monitor


## Running conn-check manually with the provided action

The charm ships with a handy action to run conn-check manually on a unit.

Unfortunately there is [a bug](https://bugs.launchpad.net/juju-core/+bug/1286613)
in juju `< 1.21` which stops `juju-run` from working correctly with subordinates,
so we instead we work around it with `juju-ssh`:

    # Assuming your unit name is conn-check/0
    juju ssh conn-check/0 'juju-run conn-check/0 actions/run-check'

**If you're using juju >= 1.21** you can just use `juju-run` directly:

    # Just run checks on conn-check/0
    juju run --unit conn-check/0 'actions/run-check'

    # Run checks on all conn-check units
    juju run --service conn-check 'actions/run-check'


## Virtualenvs and your Python app

Every install of conn-check is installed into it's own [virtualenv](https://virtualenv.pypa.io/)
so that conn-check's dependencies don't overwrite or conflict with any
system dependencies (e.g. those managed by the main charm or config manager).

## Configuration options

 * `revision`
   - The revno of conn-check to deploy, `HEAD` is used if not set.
 * `args`
   - Extra CLI arguments to pass to conn-check (see the conn-check readme for details).


## Contact Information

 * Author(s): Canonical Online Services
 * [conn-check](https://launchpad.net/conn-check)
 * [conn-check-configs](https://launchpad.net/~ubuntuone-hackers/conn-check/configs)
 * [Bugs](https://bugs.launchpad.net/conn-check)
 * [Charm bugs](https://bugs.launchpad.net/charms/+source/conn-check)