This section will introduce framework for apmec policy actions.
Apmec policy actions framework provides the MEC operators and MEA vendors to write a pluggable action that manages their own MEAs. Currently Apmec already provided some common actions like autoscaling, respawning, and logging. With this framework the custom actions can be easily applied for the management purpose.
A policy action for apmec is a python module which contains a class that inherits from “apmec.mem.policy_actions.abstract_action.AbstractPolicyAction”. If the driver depends/imports more than one module, then create a new python package under apmec/mem/policy_actions folder. After this we have to mention our driver path in setup.cfg file in root directory.
For example:
apmec.apmec.policy.actions =
respawn = apmec.mem.policy_actions.respawn.respawn:MEAActionRespawn
Following methods need to be overridden in the new action:
def get_type(self)
def get_name(self)
def get_description(self)
def execute_action(self, plugin, context, mea, arguments)
This function can be used to describe the execution process of policy. For example:
_log_monitor_events(context, mea_dict, "ActionRespawnHeat invoked")
In the monitoring policy section, you can specify the monitors details with corresponding action.
The below example shows how policy is used for alarm monitor. Example Template —————-
policies:
- vdu1_cpu_usage_monitoring_policy:
type: tosca.policies.apmec.Alarming
triggers:
resize_compute:
event_type:
type: tosca.events.resource.utilization
implementation: ceilometer
metrics: cpu_util
condition:
threshold: 50
constraint: utilization greater_than 50%
period: 65
evaluations: 1
method: avg
comparison_operator: gt
actions: [respawn]
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.