lib/alerts/alerts.js
function shouldTriggerAlert(eventDetails, alert){
  
  if (alert.alertEnabled){

    // Event Message Criteria
    var msgEventName = eventDetails.eventType;
    var msgEventCategory = eventDetails.eventClass;
    var msgEventSeverity = eventDetails.eventLevel;

    // Saved Alert Criteria
    var alertEventNames = alert.eventNames;
    var alertEventCategories = alert.eventCategories;
    var alertEventSeverities = alert.eventSeverities;

    // Test results
    var matchOnAlertEventName = alertEventNames.indexOf(msgEventName) > -1;
    var matchOnAlertEventCategory = alertEventCategories.indexOf(msgEventCategory) > -1;
    var matchOnAlertSeverity = alertEventSeverities.indexOf(msgEventSeverity) > -1;

    // if we match on the above, grab the emails from the Alert and send email (where is template???) and save Notification to Mongo (what is the record format????)
    if (matchOnAlertEventName && matchOnAlertEventCategory && matchOnAlertSeverity) {
      logger.logger.trace(loggerPrefix +'Match found. Sending emails to: ', alert.emails);
      return true;
    } else {
      logger.logger.trace(loggerPrefix +'No Match found. No emails to send');
      return false;
    }
  } else {
    return false;
  }
}
function shouldTriggerAlert(eventDetails, alert){
  
  if (alert.alertEnabled){

    // Event Message Criteria
    var msgEventName = eventDetails.eventType;
    var msgEventCategory = eventDetails.eventClass;
    var msgEventSeverity = eventDetails.eventLevel;

    // Saved Alert Criteria
    var alertEventNames = alert.eventNames;
    var alertEventCategories = alert.eventCategories;
    var alertEventSeverities = alert.eventSeverities;

    // Test results
    var matchOnAlertEventName = alertEventNames.indexOf(msgEventName) > -1;
    var matchOnAlertEventCategory = alertEventCategories.indexOf(msgEventCategory) > -1;
    var matchOnAlertSeverity = alertEventSeverities.indexOf(msgEventSeverity) > -1;

    // if we match on the above, grab the emails from the Alert and send email (where is template???) and save Notification to Mongo (what is the record format????)
    if (matchOnAlertEventName && matchOnAlertEventCategory && matchOnAlertSeverity) {
      logger.logger.trace(loggerPrefix +'Match found. Sending emails to: ', alert.emails);
      return true;
    } else {
      logger.logger.trace(loggerPrefix +'No Match found. No emails to send');
      return false;
    }
  } else {
    return false;
  }
}
function shouldTriggerAlert ( eventDetails , alert ) { if ( alert . alertEnabled ) { // Event Message Criteria var msgEventName = eventDetails . eventType ; var msgEventCategory = eventDetails . eventClass ; var msgEventSeverity = eventDetails . eventLevel ; // Saved Alert Criteria var alertEventNames = alert . eventNames ; var alertEventCategories = alert . eventCategories ; var alertEventSeverities = alert . eventSeverities ; // Test results var matchOnAlertEventName = alertEventNames . indexOf ( msgEventName ) > - 1 ; var matchOnAlertEventCategory = alertEventCategories . indexOf ( msgEventCategory ) > - 1 ; var matchOnAlertSeverity = alertEventSeverities . indexOf ( msgEventSeverity ) > - 1 ; // if we match on the above, grab the emails from the Alert and send email (where is template???) and save Notification to Mongo (what is the record format????) if ( matchOnAlertEventName && matchOnAlertEventCategory && matchOnAlertSeverity ) { logger . logger . trace ( loggerPrefix + 'Match found. Sending emails to: ' , alert . emails ) ; return true ; } else { logger . logger . trace ( loggerPrefix + 'No Match found. No emails to send' ) ; return false ; } } else { return false ; } }
Test the Alert and see if we should send an email or not
@param alert
Test the Alert and see if we should send an email or not