The heat.engine.watchrule Module

class heat.engine.watchrule.WatchRule(context, watch_name, rule, stack_id=None, state='NODATA', wid=None, watch_data=None, last_evaluated=datetime.datetime(2017, 2, 22, 13, 42, 12, 851758))[source]

Bases: object

ACTION_MAP = {'NORMAL': 'OKActions', 'ALARM': 'AlarmActions', 'NODATA': 'InsufficientDataActions'}
ALARM = 'ALARM'
CEILOMETER_CONTROLLED = 'CEILOMETER_CONTROLLED'
NODATA = 'NODATA'
NORMAL = 'NORMAL'
SUSPENDED = 'SUSPENDED'
WATCH_STATES = ('ALARM', 'NORMAL', 'NODATA', 'SUSPENDED', 'CEILOMETER_CONTROLLED')
create_watch_data(data)[source]
created_at = None
destroy()[source]

Delete the watchrule from the database.

do_Average()[source]
do_Maximum()[source]
do_Minimum()[source]
do_SampleCount()[source]

Count all samples within the specified period.

do_Sum()[source]
do_data_cmp(data, threshold)[source]
evaluate()[source]
get_alarm_state()[source]
get_details()[source]
classmethod load(context, watch_name=None, watch=None)[source]

Load the watchrule object.

The object can be loaded either from the DB by name or from an existing DB object.

rule_actions(new_state)[source]
run_rule()[source]
set_watch_state(state)[source]

Temporarily set the watch state.

Returns:list of functions to be scheduled in the stack ThreadGroup for the specified state.
state_set(state)[source]

Persistently store the watch state.

store()[source]

Store the watchrule in the database and return its ID.

If self.id is set, we update the existing rule.

updated_at = None
heat.engine.watchrule.rule_can_use_sample(wr, stats_data)[source]