Name
sn_em_ai.GetAlertConfigAndTypes
Description
Get alert configuration keys and consts
Script
var GetAlertConfigAndTypes = Class.create();
GetAlertConfigAndTypes.prototype = {
initialize: function() {},
type: 'GetAlertConfigAndTypes',
getAlertConfig: function() {
const CORRELATION_GROUP = { //
NONE: '0',
PRIMARY: '1',
SECONDARY: '2',
BOTH: '3'
};
const GROUP = { //group reference
AUTOMATED: '1',
RULES_BASED: '2',
MANUAL: '3',
CMDB: '4',
CI_CLASS_BASED: '7',
TEXT: '8',
LOG_ANALYTICS: '9',
COMPONENT_BASED: '10',
TAG_CLUSTER: '11'
};
const CATEGORY = { //extra_data.category
LOG_ANALYTICS_GROUP: '1',
LOG_ANALYTICS_ALERT: '2',
READ_ONLY: '3'
};
const ALERT_TYPE_KEY = {
STAND_ALONE_ALERT: 'STAND_ALONE_ALERT',
STAND_ALONE_LOG_ANALYTICS: 'STAND_ALONE_LOG_ANALYTICS',
GROUP_MEMBER_STAND_ALONE: 'GROUP_MEMBER_STAND_ALONE',
GROUP_MEMBER_LOG_ANALYTICS_STAND_ALONE: 'GROUP_MEMBER_LOG_ANALYTICS_STAND_ALONE',
GROUP_MEMBER_READ_ONLY: 'GROUP_MEMBER_READ_ONLY',
GROUP_MEMBER_COMPONENT_BASED: 'GROUP_MEMBER_COMPONENT_BASED',
GROUP_RULE_BASED: 'GROUP_RULE_BASED',
GROUP_MANUAL: 'GROUP_MANUAL',
GROUP_AUTOMATED: 'GROUP_AUTOMATED',
GROUP_CMDB: 'GROUP_CMDB',
GROUP_LOG_ANALYTICS: 'GROUP_LOG_ANALYTICS',
GROUP_COMPONENT_BASED: 'GROUP_COMPONENT_BASED',
GROUP_TEXT_BASED: 'GROUP_TEXT_BASED',
TAG_CLUSTER: 'TAG_CLUSTER',
};
const ALERT_TYPE = {
// EM stand alone (not anomaly)
[ALERT_TYPE_KEY.STAND_ALONE_ALERT]: {
correlation_group: CORRELATION_GROUP.NONE,
group: [null],
category: [null]
},
// Log analytics alert standalone
[ALERT_TYPE_KEY.STAND_ALONE_LOG_ANALYTICS]: {
correlation_group: CORRELATION_GROUP.NONE,
group: [null],
category: [CATEGORY.LOG_ANALYTICS_ALERT]
},
// EM standalone as a group member
[ALERT_TYPE_KEY.GROUP_MEMBER_STAND_ALONE]: {
correlation_group: CORRELATION_GROUP.SECONDARY,
group: [GROUP.AUTOMATED, GROUP.RULES_BASED, GROUP.MANUAL, GROUP.CMDB, GROUP.TEXT, GROUP.CI_CLASS_BASED],
category: [null]
},
// Log analytics alert standalone as a group member member
[ALERT_TYPE_KEY.GROUP_MEMBER_LOG_ANALYTICS_STAND_ALONE]: {
correlation_group: CORRELATION_GROUP.SECONDARY,
group: [GROUP.AUTOMATED, GROUP.RULES_BASED, GROUP.MANUAL, GROUP.CMDB, GROUP.TEXT, GROUP.LOG_ANALYTICS],
category: [CATEGORY.LOG_ANALYTICS_ALERT]
},
// Read-only (member of component based)
[ALERT_TYPE_KEY.GROUP_MEMBER_READ_ONLY]: {
correlation_group: CORRELATION_GROUP.SECONDARY,
group: [GROUP.COMPONENT_BASED],
category: [CATEGORY.READ_ONLY]
},
// Component-based as a group member
[ALERT_TYPE_KEY.GROUP_MEMBER_COMPONENT_BASED]: {
correlation_group: CORRELATION_GROUP.BOTH,
group: [GROUP.LOG_ANALYTICS],
category: [CATEGORY.LOG_ANALYTICS_ALERT]
},
//Rule based/manual– primary
[ALERT_TYPE_KEY.GROUP_RULE_BASED]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.RULES_BASED],
category: []
},
[ALERT_TYPE_KEY.GROUP_MANUAL]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.MANUAL],
category: []
},
//Automated - Group
[ALERT_TYPE_KEY.GROUP_AUTOMATED]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.AUTOMATED, GROUP.CI_CLASS_BASED],
category: [null]
},
//Tag cluster - Group
[ALERT_TYPE_KEY.TAG_CLUSTER]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.TAG_CLUSTER],
category: [null]
},
// CMDB - Group
[ALERT_TYPE_KEY.GROUP_CMDB]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.CMDB],
category: [null]
},
//Log analytics group
[ALERT_TYPE_KEY.GROUP_LOG_ANALYTICS]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.LOG_ANALYTICS],
category: [CATEGORY.LOG_ANALYTICS_GROUP]
},
//Component-based
[ALERT_TYPE_KEY.GROUP_COMPONENT_BASED]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.COMPONENT_BASED],
category: [CATEGORY.LOG_ANALYTICS_ALERT]
},
//Text based group
[ALERT_TYPE_KEY.GROUP_TEXT_BASED]: {
correlation_group: CORRELATION_GROUP.PRIMARY,
group: [GROUP.TEXT],
category: [null]
}
};
const config = {
ALERT_TYPE,
ALERT_TYPE_KEY,
CATEGORY,
GROUP,
CORRELATION_GROUP
}
return config;
}
};
Sys ID
36664b171bae2910969dec25bd4bcbe5