metadata:
 name: host_high_memory_consumption
definitions:
 entities:
  - entity:
     category: ALARM
     type: nagios
     name: 'Memory used'
     template_id: host_alarm
  - entity:
     category: RESOURCE
     type: nova.host
     template_id: host
  - entity:
     category: RESOURCE
     type: nova.instance
     template_id: instance
  - entity:
     category: ALARM
     type: vitrage
     name: instance_memory_suboptimal
     template_id: instance_alarm
 relationships:
  - relationship:
     source: host_alarm
     target: host
     relationship_type: on
     template_id : alarm_on_host
  - relationship:
     source: instance_alarm
     target: instance
     relationship_type: on
     template_id : alarm_on_instance
  - relationship:
     source: host
     target: instance
     relationship_type: contains
     template_id: host_contains_instance
scenarios:
 - scenario:
    condition: alarm_on_host
    actions:
     - action:
         action_type: set_state
         action_target:
            target: host
         properties:
            state: ERROR
 - scenario:
    condition: alarm_on_host and host_contains_instance
    actions:
     - action:
        action_type: raise_alarm
        action_target:
         target: instance
        properties:
         alarm_name: instance_memory_suboptimal
         severity: WARNING
     - action:
         action_type: set_state
         action_target:
            target: instance
         properties:
            state: SUBOPTIMAL
 - scenario:
    condition: alarm_on_host and host_contains_instance and alarm_on_instance
    actions:
     - action:
        action_type: add_causal_relationship
        action_target:
         source: host_alarm
         target: instance_alarm
