The synaps.cep.put_metric_bolt Module

class MetricMonitor(metric_key, cass)

Bases: object

CMP_MAP = {'LessThanThreshold': <built-in function lt>, 'LessThanOrEqualToThreshold': <built-in function le>, 'GreaterThanThreshold': <built-in function gt>, 'GreaterThanOrEqualToThreshold': <built-in function ge>}
CMP_STR_MAP = {'LessThanThreshold': 'less than', 'LessThanOrEqualToThreshold': 'less than or equal to', 'GreaterThanThreshold': 'greater than', 'GreaterThanOrEqualToThreshold': 'greater than or equal to'}
COLUMNS = ['Sum', 'SampleCount', 'Average', 'Minimum', 'Maximum']
ROLLING_FUNC_MAP = {'SampleCount': <function roll_sum at 0x3ee2668>, 'Average': <function roll_mean at 0x3ee26e0>, 'Minimum': <function roll_min at 0x3ee25f0>, 'Maximum': <function roll_max at 0x3ee2578>, 'Sum': <function roll_sum at 0x3ee2668>}
alarm_history_delete(alarm_key, alarm)
alarm_history_state_update(alarmkey, alarm, new_state, old_state)
check_alarms(query_time=None)
delete()
delete_metric_alarm(alarmkey)

Delete alarms from memory and database

alarmkey:
alarmkey should be UUID
do_alarm_action(alarmkey, alarm, new_state, old_state, query_date)

parameter example:

alarmkey: f459c0e0-f927-481f-9158-deb8abe102a2 alarm: OrderedDict([(‘actions_enabled’, False),

(‘alarm_actions’, u’[]’), (‘alarm_arn’, u’arn:spcs:synaps:IaaS:alarm:TEST_uc 54cub78c_02’), (‘alarm_configuration_updated_timestamp’, datetime. datetime(2012, 8, 25, 10, 51, 38, 469000)), (‘alarm_description’, u’‘), (‘alarm_name’, u’TEST_uc54cub78c_02’), (‘comparison_operator’, u’LessThanThreshold’), (‘dimensions’, u’{“instance_name”: “test instance”} ‘), (‘evaluation_periods’, 2), (‘insufficient_data_actions’, u’[]’), (‘metric_key’, UUID(‘96f19ec9-673b-4237-ae66-1bfde5 26595c’)), (‘metric_name’, u’test_metric’), (‘namespace’, u’SPCS/SYNAPSTEST’), (‘ok_actions’, u’[]’), (‘period’, 300), (‘project_id’, u’IaaS’), (‘state_reason’, u’Threshold Crossed: 2 datapoints were not less than the threshold(2.000000). The most recent datapoints: [55.25, 55.25].’), (‘state_reason_data’, u’{“startDate”: “2012-08-25T 10:30:00.000000”, “period”: 300, “threshold”: 2.0, “version”: “1.0”, “statistic”: “Average”, “recentD atapoints”: [55.25, 55.25], “queryDate”: “2012-08- 25T10:32:24.671991”}’), (‘state_updated_timestamp’, datetime.datetime(2012,

8, 25, 11, 39, 49, 657449)),

(‘state_value’, ‘OK’), (‘statistic’, u’Average’), (‘threshold’, 2.0), (‘unit’, u’Percent’), (‘reason’, u’Threshold Crossed: 3 datapoints were not less than the threshold(2.000000). The most recent datapoints: [75.0, 80.0, 67.625].’), (‘reason_data’, ‘{“startDate”: “2012-08-25T11:37:00 .000000”, “period”: 300, “threshold”: 2.0, “version”: “1.0”, “statistic”: “Average”, “recentDatapoints”: [75.0, 80.0, 67.625], “queryDate”: “2012-08-25T11:39:49.657449”}’) ])

new_state: {‘stateReason’: u’Threshold Crossed: 3 datapoints were not
less than the threshold(2.000000). The most recent datapoints: [75.0, 80.0, 67.625].’,

‘stateValue’: ‘OK’, ‘stateReasonData’: {‘startDate’: ‘2012-08-25T11:37:00’, ‘period’: 300, ‘threshold’: 2.0, ‘version’: ‘1.0’, ‘statistic’: u’Average’, ‘recentDatapoints’: [75.0, 80.0, 67.625], ‘queryDate’: ‘2012-08-25T11:39:49.657449’}}

old_state: {‘stateReason’: u’Insufficient Data: 1 datapoints were
unknown.’,

‘stateReasonData’: {u’startDate’: u‘2012-08-25T11:37:00.000000’, u’period’: 300, u’recentDatapoints’: [55.25], u’version’: u‘1.0’, u’statistic’: u’Average’, u’threshold’: 2.0, u’queryDate’: u‘2012-08-25T11:39:26.261056’}, ‘stateValue’: ‘INSUFFICIENT_DATA’}

get_metric_statistics(window, statistics, start=None, end=None, unit=None)
is_stale()
load_alarms()
load_statistics(bypass_db=False)
put_alarm(alarm_key, metricalarm)
put_metric_data(metric_key, timestamp, value, unit=None)
update_alarm_state(alarmkey, state_value, reason, reason_data, timestamp)
update_left_offset(alarms)
class PutMetricBolt

Bases: synaps.cep.storm.BasicBolt

BOLT_NAME = 'PutMetricBolt'
initialize(stormconf, context)
process(tup)
process_check_metric_alarms_msg(message)
process_delete_metric_alarms_msg(metric_key, message)
process_put_metric_alarm_msg(metric_key, message)
process_put_metric_data_msg(metric_key, message)

Put metric data into both memory and database

process_set_alarm_state_msg(metric_key, message)

Previous topic

The synaps.cep.check_spout Module

Next topic

The synaps.cep.storm Module

This Page