Ejemplo n.º 1
0
                if normalize_bool(settings.get('auto_close_info')) and metadata['priority'] == 'informational':
                    log.debug('Auto close informational is on')
                    setIncidentAutoInfoResolved(ic, settings.get('index'), sessionKey, settings.get('auto_close_info_status'))
                    auto_info_resolved = True

            except:
                log.error('Attempting to auto resolve for incident_id=%s resulted in an exception. %s' % (incident_id, traceback.format_exc()))


        # Handle auto-assign
        # Added a check to see if the event was resolved as a duplicate. We don't need to do this if it is...
        if config['auto_assign_owner'] != '' and config['auto_assign_owner'] != 'unassigned' and incident_suppressed == False and is_subsequent_resolved == False and auto_info_resolved == False:
            log.debug("auto_assign is active for %s. Starting to handle it." % search_name)
            setOwner(incident_key, incident_id, config['auto_assign_owner'], sessionKey)
            setStatus(incident_key, incident_id, 'auto_assigned', sessionKey)
            ic.update("owner", config['auto_assign_owner'])

            event = 'severity=INFO origin="alert_handler" user="******" action="change" incident_id="%s" job_id="%s" result_id="%s" owner="%s" previous_owner="unassigned"' % (incident_id, job_id, result_id, config['auto_assign_owner'])
            createIncidentChangeEvent(event, metadata['job_id'], settings.get('index'))

            event = 'severity=INFO origin="alert_handler" user="******" action="change" incident_id="%s" job_id="%s" result_id="%s" status="auto_assigned" previous_status="new"' % (incident_id, job_id, result_id)
            createIncidentChangeEvent(event, metadata['job_id'], settings.get('index'))

            if config['auto_subsequent_resolve'] == False:
                eh.handleEvent(alert=search_name, event="incident_auto_assigned", incident={"owner": config["auto_assign_owner"]}, context=ic.getContext())



        #
        # END Incident creation
        #
Ejemplo n.º 2
0
            except:
                log.error(
                    'Attempting to auto resolve for incident_id=%s resulted in an exception. %s'
                    % (incident_id, traceback.format_exc()))

        # Handle auto-assign
        # Added a check to see if the event was resolved as a duplicate. We don't need to do this if it is...
        if config['auto_assign_owner'] != '' and config[
                'auto_assign_owner'] != 'unassigned' and incident_suppressed == False and is_subsequent_resolved == False and auto_info_resolved == False:
            log.debug("auto_assign is active for %s. Starting to handle it." %
                      search_name)
            setOwner(incident_key, incident_id, config['auto_assign_owner'],
                     sessionKey)
            setStatus(incident_key, incident_id, 'auto_assigned', sessionKey)
            ic.update("owner", config['auto_assign_owner'])

            event = 'severity=INFO origin="alert_handler" user="******" action="change" incident_id="%s" job_id="%s" result_id="%s" owner="%s" previous_owner="unassigned"' % (
                incident_id, job_id, result_id, config['auto_assign_owner'])
            createIncidentChangeEvent(event, metadata['job_id'],
                                      settings.get('index'))

            event = 'severity=INFO origin="alert_handler" user="******" action="change" incident_id="%s" job_id="%s" result_id="%s" status="auto_assigned" previous_status="new"' % (
                incident_id, job_id, result_id)
            createIncidentChangeEvent(event, metadata['job_id'],
                                      settings.get('index'))

            if config['auto_subsequent_resolve'] == False:
                eh.handleEvent(alert=search_name,
                               event="incident_auto_assigned",
                               incident={"owner": config["auto_assign_owner"]},