hpcloud-mon/mon-api — pull request #1 by craigbr (2014-05-30 18:57:04+00:00)
Title: JAH-1891 Threshold Engine will not update State properly if user has cha...

...nged state via the API

Set the new oldState and unchangedExpressions fields in the AlarmCreatedEvent

This is dependent on a change in mob-common to add oldAlarmState and unchangedExpressions.

This is needed for some use cases in the Threshold Engine. The easiest one is where there is an alarm like:
max(cpu) > 90 or max(load) > 10. The alarm is in state ALARM because the load is 11, but the cpu is 80. The user modifies the alarm by removing the second sub expression and would expect the alarm to transition to OK. However, because the Threshold Engine is event driven, there will be no event to drive this change.

Having the new field unchangedExpressions allows the Threshold Engine to force a reevaluation of all the sub alarms so the Alarm will transition correctly. The Threshold Engine could go to the database to get the unchanged sub alarms, but it seems cleaner to just send the unchanged expressions along in the AlarmUpdatedEvent.

Please do not merge this in, just review it. The mon-common and mon-thresh changes have to be committed in concert