~1chb1n/charms/trusty/neutron-api/next-amulet-net-types-update

« back to all changes in this revision

Viewing changes to hooks/neutron_api_hooks.py

  • Committer: root
  • Date: 2014-10-30 03:30:36 UTC
  • mto: This revision was merged to the branch mainline in revision 70.
  • Revision ID: root+boostack-staging@canonical.com-20141030033036-qwbruw9snu8s7a4a
[bradm] initial nrpe checks

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
from charmhelpers.contrib.openstack.context import ADDRESS_TYPES
75
75
 
 
76
from charmhelpers.contrib.charmsupport.nrpe import NRPE
 
77
 
76
78
hooks = Hooks()
77
79
CONFIGS = register_configs()
78
80
 
120
122
    if openstack_upgrade_available('neutron-server'):
121
123
        do_openstack_upgrade(CONFIGS)
122
124
    configure_https()
 
125
    update_nrpe_config()
123
126
    CONFIGS.write_all()
124
127
    for r_id in relation_ids('neutron-api'):
125
128
        neutron_api_relation_joined(rid=r_id)
369
372
        neutron_api_relation_joined(rid=rid)
370
373
 
371
374
 
 
375
@hooks.hook('nrpe-external-master-relation-joined', 'nrpe-external-master-relation-changed')
 
376
def update_nrpe_config():
 
377
    nrpe = NRPE()
 
378
    apt_install('python-dbus')
 
379
    
 
380
    nrpe.add_check(
 
381
        shortname='neutron-api',
 
382
        description='neutron-server process',
 
383
        check_cmd = 'check_upstart_job neutron-server',
 
384
        )
 
385
 
 
386
    nrpe.write()
 
387
 
 
388
 
372
389
def main():
373
390
    try:
374
391
        hooks.execute(sys.argv)