def __init__(self, name, inEventQueue, inAlertQueue, outQueue, config_dict=None, number=0): ''' The constructor ''' AlertAnalyzer.__init__(self, name, inEventQueue, inAlertQueue, outQueue, config_dict, number) # Common mode alert info self.alertId = 'COMMON01' self.severity = 'W' self.recommendation = "Check the environmental monitor data for LOC_PARENT." self.reason = "Multiple alerts have been logged against LOC_NAMEs on LOC_PARENT. The cause may be due to a common mode failure. Analyze LOC_PARENT environmental data for abnormalities prior to replacing individual LOC_NAMEs." # Get alert manager self.alertMgr = registry.get_service(registry.SERVICE_ALERT_MGR) # Get the configuration info for alert analyzer self.cfg = registry.get_service(registry.SERVICE_CONFIGURATION) self.window_time = self.get_window_time() self.threshold = self.get_threshold() # Alert table query schema = str(db_interface.TABLE_TEMPLATE).split('.') alertTable = schema[0] + '.x_tealalertlog' alert2eventTable = schema[0] + '.x_tealalert2event' eventTable = schema[0] + '.tbgqeventlog' query_time_window = "\"creation_time\" >= (timestamp('ALERT_TIME') - WINDOW) and \"creation_time\" < timestamp('ALERT_TIME')" self.query = "select \"event_loc\" from " + alertTable + " where \"state\" = 1 and \"event_loc\" like 'PLOC%' and \"event_loc\" not like 'LOCATION' and " + query_time_window self.dup_query = "select \"event_loc\" from " + alertTable + " where \"state\" = 1 and \"alert_id\" = 'COMMON01' and " + query_time_window + " and " self.alert_recid_query1 = "select \"rec_id\" from " + alertTable + " where \"state\" = 1 and (\"alert_id\" = 'COMMON01' or \"alert_id\" = 'HWERR01') and " + query_time_window self.alert_recid_query2 = "select \"rec_id\" from " + alertTable + " where \"state\" = 1 and (\"alert_id\" = 'COMMON01' or \"alert_id\" = 'HWERR01' or \"alert_id\" = 'ENDJOB01') and " + query_time_window self.event_recid_query = "select \"t_event_recid\" from " + alert2eventTable + " where \"alert_recid\" = ?" self.event_block_id_query = "select block from " + eventTable + " where recid = ?" query_time_window_str = "\"creation_time\" >= (timestamp('{0}') - {1}) and \"creation_time\" < timestamp('{0}')" self.same_block_query_str = "select count(*) from " + alertTable + " where \"state\" = 1 and (\"alert_id\" = 'COMMON01' or \"alert_id\" = 'HWERR01' or \"alert_id\" = 'ENDJOB01') and " + query_time_window_str + " and \"rec_id\" in (select \"alert_recid\" from " + alert2eventTable + " where \"t_event_recid\" in (select recid from " + eventTable + " where block = '{2}'))" return
def __init__(self, name, inEventQueue, inAlertQueue, outQueue, config_dict=None, number=0): ''' save some stuff for testing ''' AlertAnalyzer.__init__(self, name, inEventQueue, inAlertQueue, outQueue, config_dict, number) self.alerts = [] self.events = [] self.control_msgs = []