def __init__(self): '''Constructor rec_id -- a unique id (the primary key) in_dict -- a dictionary of all attributes for the Event ''' get_logger().debug('Creating an event') Incident.__init__(self) return
def __init__(self, rec_id, alert_id, in_dict): '''Constructor Alerts should NOT be created directly but should be created and manipulated via the AlertMgr class. Directly working with the Alert class can cause changes to the alert to not be persisted. This creates an in memory version of an alert. It does not have to be complete or valid at this point. Resolve and validate should be called to ensure completeness alert_id -- Required -- alert id for the alert in_dict -- Optional -- other attributes of the alert ''' ## Check input # Alert id must be specified if alert_id is None: get_logger().error('Alert constructor -- alert id is required') raise ValueError ## Initialize attributes self.alert_id = alert_id self.rec_id = rec_id self.creation_time = None self.event_loc = None self.reason = None self.msg_template = None self.recommendation = None self.urgency = None self.severity = None self.src_name = None self.state = ALERT_STATE_INCOMPLETE # Optional self.dup_alert_recid = None self.fru_loc = None self.raw_data = None # associations self.supresses = set() self.condition_events = set() self.duplicates = set() self.subst_dict = None self.priority = None Incident.__init__(self) ## Read from the dictionary if in_dict is not None: self._read_from_dictionary(in_dict) return
def __init__(self, rec_id, incident_id, time_occurred=None): '''Constructor uuid -- unique id name -- name this is referred to by type -- ''' get_logger().debug('Creating Incident') self.rec_id = rec_id self.incident_id = incident_id if time_occurred is None: self.time_occurred = datetime.now() else: self.time_occurred = time_occurred Incident.__init__(self) return