1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 vitrage_template_file = \
13 '/etc/vitrage/templates/vitrage_host_down_scenarios.yaml'
17 name: host_down_scenarios
18 description: scenarios triggered by Doctor monitor 'compute.host.down' alarm
23 name: compute.host.down
24 template_id: host_down_alarm
29 template_id: instance_alarm
40 source: host_down_alarm
43 template_id : host_down_alarm_on_host
46 relationship_type: contains
48 template_id : host_contains_instance
50 source: instance_alarm
53 template_id : alarm_on_instance
56 condition: host_down_alarm_on_host
59 action_type: set_state
65 action_type: mark_down
69 condition: host_down_alarm_on_host and host_contains_instance
72 action_type: raise_alarm
76 alarm_name: Instance Down
79 condition: host_down_alarm_on_host and host_contains_instance and alarm_on_instance
82 action_type: add_causal_relationship
84 source: host_down_alarm
85 target: instance_alarm
87 action_type: mark_down
93 def set_vitrage_host_down_template():
94 if os.path.isfile(vitrage_template_file):
95 print('Vitrage host_down template file: %s already exists.'
96 % vitrage_template_file)
98 print('Create Vitrage host_down template file:%s.'
99 % vitrage_template_file)
100 with open(vitrage_template_file, 'w') as file: