- #self.logger.info("Triggered Alarm {}".format(alarm))
- if alarm['alertDefinitionName'] is not None and\
- len(alarm['alertDefinitionName'].split('-', 1)) == 2:
- if alarm['alertDefinitionName'].split('-', 1)[1] == ro_resource_uuid:
- alarm_instance = {}
- alarm_instance['alarm_uuid'] = alarm['alertDefinitionId'].split('-', 1)[1]
- alarm_instance['resource_uuid'] = ro_resource_uuid
- alarm_instance['alarm_instance_uuid'] = alarm['alertId']
- alarm_instance['vim_type'] = 'VMware'
- #find severity of alarm
- severity = None
- for key,value in six.iteritems(severity_mano2vrops):
- if value == alarm['alertLevel']:
- severity = key
- if severity is None:
- severity = 'INDETERMINATE'
- alarm_instance['severity'] = severity
- alarm_instance['status'] = alarm['status']
- alarm_instance['start_date'] = self.convert_date_time(alarm['startTimeUTC'])
- alarm_instance['update_date'] = self.convert_date_time(alarm['updateTimeUTC'])
- alarm_instance['cancel_date'] = self.convert_date_time(alarm['cancelTimeUTC'])
- self.logger.info("Triggered Alarm on resource {}".format(alarm_instance))
- resource_alarms.append(alarm_instance)
+ # logger.info("Triggered Alarm {}".format(alarm))
+ if alarm['alertDefinitionName'] is not None and \
+ len(alarm['alertDefinitionName'].split('-', 1)) == 2:
+ if alarm['alertDefinitionName'].split('-', 1)[1] == ro_resource_uuid:
+ alarm_instance = {'alarm_uuid': alarm['alertDefinitionId'].split('-', 1)[1],
+ 'resource_uuid': ro_resource_uuid,
+ 'alarm_instance_uuid': alarm['alertId'],
+ 'vim_type': 'VMware'}
+ # find severity of alarm
+ severity = None
+ for key, value in six.iteritems(severity_mano2vrops):
+ if value == alarm['alertLevel']:
+ severity = key
+ if severity is None:
+ severity = 'INDETERMINATE'
+ alarm_instance['severity'] = severity
+ alarm_instance['status'] = alarm['status']
+ alarm_instance['start_date'] = self.convert_date_time(alarm['startTimeUTC'])
+ alarm_instance['update_date'] = self.convert_date_time(alarm['updateTimeUTC'])
+ alarm_instance['cancel_date'] = self.convert_date_time(alarm['cancelTimeUTC'])
+ logger.info("Triggered Alarm on resource {}".format(alarm_instance))
+ resource_alarms.append(alarm_instance)