~johnsca/charms/trusty/haproxy-v1/trunk

« back to all changes in this revision

Viewing changes to hooks/cloudfoundry/health_checks.py

  • Committer: Cory Johns
  • Date: 2014-09-29 14:29:01 UTC
  • Revision ID: cory.johns@canonical.com-20140929142901-c721pb349xqhg5ms
haproxy version 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from cloudfoundry import tasks
 
2
 
 
3
 
 
4
def monit_summary(service):
 
5
    result = {
 
6
        'name': 'monit_summary',
 
7
        'health': 'pass',
 
8
        'message': None,
 
9
        'data': {},
 
10
    }
 
11
    summary = tasks.monit.summary()
 
12
    if summary is None:
 
13
        return dict(result, health='fail', message='unable to get summary')
 
14
    if any(v != 'Running' for v in summary.values()):
 
15
        return dict(result,
 
16
                    health='fail',
 
17
                    message='not all services running',
 
18
                    data={'services': summary})
 
19
    return result