mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Stack Monitoring] Rename alerts to rules (#107654)
* rename constants and alert types to rules * update test language * update BaseRule properties to rule * change rawAlert to sanitizedRule Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
faf6482e01
commit
bc25c0fca9
72 changed files with 795 additions and 814 deletions
|
@ -220,29 +220,29 @@ export const CLUSTER_DETAILS_FETCH_INTERVAL = 10800000;
|
|||
export const USAGE_FETCH_INTERVAL = 1200000;
|
||||
|
||||
/**
|
||||
* The prefix for all alert types used by monitoring
|
||||
* The prefix for all rule types used by monitoring
|
||||
*/
|
||||
export const ALERT_PREFIX = 'monitoring_';
|
||||
export const ALERT_LICENSE_EXPIRATION = `${ALERT_PREFIX}alert_license_expiration`;
|
||||
export const ALERT_CLUSTER_HEALTH = `${ALERT_PREFIX}alert_cluster_health`;
|
||||
export const ALERT_CPU_USAGE = `${ALERT_PREFIX}alert_cpu_usage`;
|
||||
export const ALERT_DISK_USAGE = `${ALERT_PREFIX}alert_disk_usage`;
|
||||
export const ALERT_NODES_CHANGED = `${ALERT_PREFIX}alert_nodes_changed`;
|
||||
export const ALERT_ELASTICSEARCH_VERSION_MISMATCH = `${ALERT_PREFIX}alert_elasticsearch_version_mismatch`;
|
||||
export const ALERT_KIBANA_VERSION_MISMATCH = `${ALERT_PREFIX}alert_kibana_version_mismatch`;
|
||||
export const ALERT_LOGSTASH_VERSION_MISMATCH = `${ALERT_PREFIX}alert_logstash_version_mismatch`;
|
||||
export const ALERT_MEMORY_USAGE = `${ALERT_PREFIX}alert_jvm_memory_usage`;
|
||||
export const ALERT_MISSING_MONITORING_DATA = `${ALERT_PREFIX}alert_missing_monitoring_data`;
|
||||
export const ALERT_THREAD_POOL_SEARCH_REJECTIONS = `${ALERT_PREFIX}alert_thread_pool_search_rejections`;
|
||||
export const ALERT_THREAD_POOL_WRITE_REJECTIONS = `${ALERT_PREFIX}alert_thread_pool_write_rejections`;
|
||||
export const ALERT_CCR_READ_EXCEPTIONS = `${ALERT_PREFIX}ccr_read_exceptions`;
|
||||
export const ALERT_LARGE_SHARD_SIZE = `${ALERT_PREFIX}shard_size`;
|
||||
export const RULE_PREFIX = 'monitoring_';
|
||||
export const RULE_LICENSE_EXPIRATION = `${RULE_PREFIX}alert_license_expiration`;
|
||||
export const RULE_CLUSTER_HEALTH = `${RULE_PREFIX}alert_cluster_health`;
|
||||
export const RULE_CPU_USAGE = `${RULE_PREFIX}alert_cpu_usage`;
|
||||
export const RULE_DISK_USAGE = `${RULE_PREFIX}alert_disk_usage`;
|
||||
export const RULE_NODES_CHANGED = `${RULE_PREFIX}alert_nodes_changed`;
|
||||
export const RULE_ELASTICSEARCH_VERSION_MISMATCH = `${RULE_PREFIX}alert_elasticsearch_version_mismatch`;
|
||||
export const RULE_KIBANA_VERSION_MISMATCH = `${RULE_PREFIX}alert_kibana_version_mismatch`;
|
||||
export const RULE_LOGSTASH_VERSION_MISMATCH = `${RULE_PREFIX}alert_logstash_version_mismatch`;
|
||||
export const RULE_MEMORY_USAGE = `${RULE_PREFIX}alert_jvm_memory_usage`;
|
||||
export const RULE_MISSING_MONITORING_DATA = `${RULE_PREFIX}alert_missing_monitoring_data`;
|
||||
export const RULE_THREAD_POOL_SEARCH_REJECTIONS = `${RULE_PREFIX}alert_thread_pool_search_rejections`;
|
||||
export const RULE_THREAD_POOL_WRITE_REJECTIONS = `${RULE_PREFIX}alert_thread_pool_write_rejections`;
|
||||
export const RULE_CCR_READ_EXCEPTIONS = `${RULE_PREFIX}ccr_read_exceptions`;
|
||||
export const RULE_LARGE_SHARD_SIZE = `${RULE_PREFIX}shard_size`;
|
||||
|
||||
/**
|
||||
* Legacy alerts details/label for server and public use
|
||||
* Legacy rules details/label for server and public use
|
||||
*/
|
||||
export const LEGACY_ALERT_DETAILS = {
|
||||
[ALERT_CLUSTER_HEALTH]: {
|
||||
export const LEGACY_RULE_DETAILS = {
|
||||
[RULE_CLUSTER_HEALTH]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.clusterHealth.label', {
|
||||
defaultMessage: 'Cluster health',
|
||||
}),
|
||||
|
@ -250,7 +250,7 @@ export const LEGACY_ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when the health of the cluster changes.',
|
||||
}),
|
||||
},
|
||||
[ALERT_ELASTICSEARCH_VERSION_MISMATCH]: {
|
||||
[RULE_ELASTICSEARCH_VERSION_MISMATCH]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.elasticsearchVersionMismatch.label', {
|
||||
defaultMessage: 'Elasticsearch version mismatch',
|
||||
}),
|
||||
|
@ -261,7 +261,7 @@ export const LEGACY_ALERT_DETAILS = {
|
|||
}
|
||||
),
|
||||
},
|
||||
[ALERT_KIBANA_VERSION_MISMATCH]: {
|
||||
[RULE_KIBANA_VERSION_MISMATCH]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.kibanaVersionMismatch.label', {
|
||||
defaultMessage: 'Kibana version mismatch',
|
||||
}),
|
||||
|
@ -269,7 +269,7 @@ export const LEGACY_ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when the cluser has multiple versions of Kibana.',
|
||||
}),
|
||||
},
|
||||
[ALERT_LICENSE_EXPIRATION]: {
|
||||
[RULE_LICENSE_EXPIRATION]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.licenseExpiration.label', {
|
||||
defaultMessage: 'License expiration',
|
||||
}),
|
||||
|
@ -277,7 +277,7 @@ export const LEGACY_ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when the cluster license is about to expire.',
|
||||
}),
|
||||
},
|
||||
[ALERT_LOGSTASH_VERSION_MISMATCH]: {
|
||||
[RULE_LOGSTASH_VERSION_MISMATCH]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.logstashVersionMismatch.label', {
|
||||
defaultMessage: 'Logstash version mismatch',
|
||||
}),
|
||||
|
@ -285,7 +285,7 @@ export const LEGACY_ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when the cluster has multiple versions of Logstash.',
|
||||
}),
|
||||
},
|
||||
[ALERT_NODES_CHANGED]: {
|
||||
[RULE_NODES_CHANGED]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.nodesChanged.label', {
|
||||
defaultMessage: 'Nodes changed',
|
||||
}),
|
||||
|
@ -296,10 +296,10 @@ export const LEGACY_ALERT_DETAILS = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Alerts details/label for server and public use
|
||||
* Rules details/label for server and public use
|
||||
*/
|
||||
export const ALERT_DETAILS = {
|
||||
[ALERT_CPU_USAGE]: {
|
||||
export const RULE_DETAILS = {
|
||||
[RULE_CPU_USAGE]: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.cpuUsage.label', {
|
||||
defaultMessage: 'CPU Usage',
|
||||
}),
|
||||
|
@ -321,7 +321,7 @@ export const ALERT_DETAILS = {
|
|||
} as CommonAlertParamDetail,
|
||||
},
|
||||
},
|
||||
[ALERT_DISK_USAGE]: {
|
||||
[RULE_DISK_USAGE]: {
|
||||
paramDetails: {
|
||||
threshold: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.diskUsage.paramDetails.threshold.label', {
|
||||
|
@ -343,7 +343,7 @@ export const ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when the disk usage for a node is consistently high.',
|
||||
}),
|
||||
},
|
||||
[ALERT_MEMORY_USAGE]: {
|
||||
[RULE_MEMORY_USAGE]: {
|
||||
paramDetails: {
|
||||
threshold: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.memoryUsage.paramDetails.threshold.label', {
|
||||
|
@ -365,7 +365,7 @@ export const ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when a node reports high memory usage.',
|
||||
}),
|
||||
},
|
||||
[ALERT_MISSING_MONITORING_DATA]: {
|
||||
[RULE_MISSING_MONITORING_DATA]: {
|
||||
paramDetails: {
|
||||
duration: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.missingData.paramDetails.duration.label', {
|
||||
|
@ -387,7 +387,7 @@ export const ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert when monitoring data is missing.',
|
||||
}),
|
||||
},
|
||||
[ALERT_THREAD_POOL_SEARCH_REJECTIONS]: {
|
||||
[RULE_THREAD_POOL_SEARCH_REJECTIONS]: {
|
||||
paramDetails: {
|
||||
threshold: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.rejection.paramDetails.threshold.label', {
|
||||
|
@ -412,7 +412,7 @@ export const ALERT_DETAILS = {
|
|||
'Alert when the number of rejections in the search thread pool exceeds the threshold.',
|
||||
}),
|
||||
},
|
||||
[ALERT_THREAD_POOL_WRITE_REJECTIONS]: {
|
||||
[RULE_THREAD_POOL_WRITE_REJECTIONS]: {
|
||||
paramDetails: {
|
||||
threshold: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.rejection.paramDetails.threshold.label', {
|
||||
|
@ -437,7 +437,7 @@ export const ALERT_DETAILS = {
|
|||
'Alert when the number of rejections in the write thread pool exceeds the threshold.',
|
||||
}),
|
||||
},
|
||||
[ALERT_CCR_READ_EXCEPTIONS]: {
|
||||
[RULE_CCR_READ_EXCEPTIONS]: {
|
||||
paramDetails: {
|
||||
duration: {
|
||||
label: i18n.translate(
|
||||
|
@ -456,7 +456,7 @@ export const ALERT_DETAILS = {
|
|||
defaultMessage: 'Alert if any CCR read exceptions have been detected.',
|
||||
}),
|
||||
},
|
||||
[ALERT_LARGE_SHARD_SIZE]: {
|
||||
[RULE_LARGE_SHARD_SIZE]: {
|
||||
paramDetails: {
|
||||
threshold: {
|
||||
label: i18n.translate('xpack.monitoring.alerts.shardSize.paramDetails.threshold.label', {
|
||||
|
@ -482,74 +482,74 @@ export const ALERT_DETAILS = {
|
|||
},
|
||||
};
|
||||
|
||||
export const ALERT_PANEL_MENU = [
|
||||
export const RULE_PANEL_MENU = [
|
||||
{
|
||||
label: i18n.translate('xpack.monitoring.alerts.badge.panelCategory.clusterHealth', {
|
||||
defaultMessage: 'Cluster health',
|
||||
}),
|
||||
alerts: [
|
||||
{ alertName: ALERT_NODES_CHANGED },
|
||||
{ alertName: ALERT_CLUSTER_HEALTH },
|
||||
{ alertName: ALERT_ELASTICSEARCH_VERSION_MISMATCH },
|
||||
{ alertName: ALERT_KIBANA_VERSION_MISMATCH },
|
||||
{ alertName: ALERT_LOGSTASH_VERSION_MISMATCH },
|
||||
rules: [
|
||||
{ ruleName: RULE_NODES_CHANGED },
|
||||
{ ruleName: RULE_CLUSTER_HEALTH },
|
||||
{ ruleName: RULE_ELASTICSEARCH_VERSION_MISMATCH },
|
||||
{ ruleName: RULE_KIBANA_VERSION_MISMATCH },
|
||||
{ ruleName: RULE_LOGSTASH_VERSION_MISMATCH },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.monitoring.alerts.badge.panelCategory.resourceUtilization', {
|
||||
defaultMessage: 'Resource utilization',
|
||||
}),
|
||||
alerts: [
|
||||
{ alertName: ALERT_CPU_USAGE },
|
||||
{ alertName: ALERT_DISK_USAGE },
|
||||
{ alertName: ALERT_MEMORY_USAGE },
|
||||
{ alertName: ALERT_LARGE_SHARD_SIZE },
|
||||
rules: [
|
||||
{ ruleName: RULE_CPU_USAGE },
|
||||
{ ruleName: RULE_DISK_USAGE },
|
||||
{ ruleName: RULE_MEMORY_USAGE },
|
||||
{ ruleName: RULE_LARGE_SHARD_SIZE },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.monitoring.alerts.badge.panelCategory.errors', {
|
||||
defaultMessage: 'Errors and exceptions',
|
||||
}),
|
||||
alerts: [
|
||||
{ alertName: ALERT_MISSING_MONITORING_DATA },
|
||||
{ alertName: ALERT_LICENSE_EXPIRATION },
|
||||
{ alertName: ALERT_THREAD_POOL_SEARCH_REJECTIONS },
|
||||
{ alertName: ALERT_THREAD_POOL_WRITE_REJECTIONS },
|
||||
{ alertName: ALERT_CCR_READ_EXCEPTIONS },
|
||||
rules: [
|
||||
{ ruleName: RULE_MISSING_MONITORING_DATA },
|
||||
{ ruleName: RULE_LICENSE_EXPIRATION },
|
||||
{ ruleName: RULE_THREAD_POOL_SEARCH_REJECTIONS },
|
||||
{ ruleName: RULE_THREAD_POOL_WRITE_REJECTIONS },
|
||||
{ ruleName: RULE_CCR_READ_EXCEPTIONS },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* A listing of all alert types
|
||||
* A listing of all rule types
|
||||
*/
|
||||
export const ALERTS = [
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
ALERT_KIBANA_VERSION_MISMATCH,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
export const RULES = [
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_CLUSTER_HEALTH,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
RULE_KIBANA_VERSION_MISMATCH,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of all legacy alerts, which means they are powered by watcher
|
||||
* A list of all legacy rules, which means they are powered by watcher
|
||||
*/
|
||||
export const LEGACY_ALERTS = [
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
ALERT_KIBANA_VERSION_MISMATCH,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
export const LEGACY_RULES = [
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_CLUSTER_HEALTH,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
RULE_KIBANA_VERSION_MISMATCH,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -564,9 +564,9 @@ export const ALERT_ACTION_TYPE_EMAIL = '.email';
|
|||
export const ALERT_ACTION_TYPE_LOG = '.server-log';
|
||||
|
||||
/**
|
||||
* To enable modifing of alerts in under actions
|
||||
* To enable modifing of rules in under actions
|
||||
*/
|
||||
export const ALERT_REQUIRES_APP_CONTEXT = false;
|
||||
export const RULE_REQUIRES_APP_CONTEXT = false;
|
||||
|
||||
export const ALERT_EMAIL_SERVICES = ['gmail', 'hotmail', 'icloud', 'outlook365', 'ses', 'yahoo'];
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ export interface RulesByType {
|
|||
}
|
||||
export interface CommonAlertStatus {
|
||||
states: CommonAlertState[];
|
||||
rawAlert: Alert<AlertTypeParams> | SanitizedAlert<AlertTypeParams>;
|
||||
sanitizedRule: Alert<AlertTypeParams> | SanitizedAlert<AlertTypeParams>;
|
||||
}
|
||||
|
||||
export interface CommonAlertState {
|
||||
|
|
|
@ -46,7 +46,7 @@ export const AlertsBadge: React.FC<Props> = (props: Props) => {
|
|||
// We do not always have the alerts that each consumer wants due to licensing
|
||||
const { stateFilter = () => true } = props;
|
||||
const alertsList = Object.values(props.alerts).flat();
|
||||
const alerts = alertsList.filter((alertItem) => Boolean(alertItem?.rawAlert));
|
||||
const alerts = alertsList.filter((alertItem) => Boolean(alertItem?.sanitizedRule));
|
||||
const [showPopover, setShowPopover] = React.useState<AlertSeverity | boolean | null>(null);
|
||||
const inSetupMode = isInSetupMode(React.useContext(SetupModeContext));
|
||||
const alertCount = inSetupMode
|
||||
|
|
|
@ -103,7 +103,7 @@ export const AlertsCallout: React.FC<Props> = (props: Props) => {
|
|||
}
|
||||
)}
|
||||
<EuiListGroupItem
|
||||
label={<AlertConfiguration alert={status.alert.rawAlert} key={index} compressed />}
|
||||
label={<AlertConfiguration alert={status.alert.sanitizedRule} key={index} compressed />}
|
||||
/>
|
||||
</EuiListGroup>
|
||||
</EuiAccordion>
|
||||
|
|
|
@ -10,9 +10,9 @@ import { i18n } from '@kbn/i18n';
|
|||
import { Expression, Props } from '../components/param_details_form/expression';
|
||||
import { AlertTypeModel, ValidationResult } from '../../../../triggers_actions_ui/public';
|
||||
import {
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
RULE_DETAILS,
|
||||
RULE_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
import { AlertTypeParams } from '../../../../alerting/common';
|
||||
|
||||
|
@ -38,17 +38,17 @@ const validate = (inputValues: ValidateOptions): ValidationResult => {
|
|||
|
||||
export function createCCRReadExceptionsAlertType(): AlertTypeModel<ValidateOptions> {
|
||||
return {
|
||||
id: ALERT_CCR_READ_EXCEPTIONS,
|
||||
description: ALERT_DETAILS[ALERT_CCR_READ_EXCEPTIONS].description,
|
||||
id: RULE_CCR_READ_EXCEPTIONS,
|
||||
description: RULE_DETAILS[RULE_CCR_READ_EXCEPTIONS].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaCCRReadExceptions}`;
|
||||
},
|
||||
alertParamsExpression: (props: Props) => (
|
||||
<Expression {...props} paramDetails={ALERT_DETAILS[ALERT_CCR_READ_EXCEPTIONS].paramDetails} />
|
||||
<Expression {...props} paramDetails={RULE_DETAILS[RULE_CCR_READ_EXCEPTIONS].paramDetails} />
|
||||
),
|
||||
validate,
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,27 +8,23 @@
|
|||
import React from 'react';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
|
||||
import {
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
import { RULE_CPU_USAGE, RULE_DETAILS, RULE_REQUIRES_APP_CONTEXT } from '../../../common/constants';
|
||||
import { validate, MonitoringAlertTypeParams } from '../components/param_details_form/validation';
|
||||
import { Expression, Props } from '../components/param_details_form/expression';
|
||||
|
||||
export function createCpuUsageAlertType(): AlertTypeModel<MonitoringAlertTypeParams> {
|
||||
return {
|
||||
id: ALERT_CPU_USAGE,
|
||||
description: ALERT_DETAILS[ALERT_CPU_USAGE].description,
|
||||
id: RULE_CPU_USAGE,
|
||||
description: RULE_DETAILS[RULE_CPU_USAGE].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaCpuThreshold}`;
|
||||
},
|
||||
alertParamsExpression: (props: Props) => (
|
||||
<Expression {...props} paramDetails={ALERT_DETAILS[ALERT_CPU_USAGE].paramDetails} />
|
||||
<Expression {...props} paramDetails={RULE_DETAILS[RULE_CPU_USAGE].paramDetails} />
|
||||
),
|
||||
validate,
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,24 +12,24 @@ import { Expression, Props } from '../components/param_details_form/expression';
|
|||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
|
||||
import {
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_DETAILS,
|
||||
RULE_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
|
||||
export function createDiskUsageAlertType(): AlertTypeModel<MonitoringAlertTypeParams> {
|
||||
return {
|
||||
id: ALERT_DISK_USAGE,
|
||||
description: ALERT_DETAILS[ALERT_DISK_USAGE].description,
|
||||
id: RULE_DISK_USAGE,
|
||||
description: RULE_DETAILS[RULE_DISK_USAGE].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaDiskThreshold}`;
|
||||
},
|
||||
alertParamsExpression: (props: Props) => (
|
||||
<Expression {...props} paramDetails={ALERT_DETAILS[ALERT_DISK_USAGE].paramDetails} />
|
||||
<Expression {...props} paramDetails={RULE_DETAILS[RULE_DISK_USAGE].paramDetails} />
|
||||
),
|
||||
validate,
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import { i18n } from '@kbn/i18n';
|
|||
import { Expression, Props } from '../components/param_details_form/expression';
|
||||
import { AlertTypeModel, ValidationResult } from '../../../../triggers_actions_ui/public';
|
||||
import {
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
RULE_DETAILS,
|
||||
RULE_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
import { AlertTypeParams } from '../../../../alerting/common';
|
||||
|
||||
|
@ -38,17 +38,17 @@ const validate = (inputValues: ValidateOptions): ValidationResult => {
|
|||
|
||||
export function createLargeShardSizeAlertType(): AlertTypeModel<ValidateOptions> {
|
||||
return {
|
||||
id: ALERT_LARGE_SHARD_SIZE,
|
||||
description: ALERT_DETAILS[ALERT_LARGE_SHARD_SIZE].description,
|
||||
id: RULE_LARGE_SHARD_SIZE,
|
||||
description: RULE_DETAILS[RULE_LARGE_SHARD_SIZE].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaLargeShardSize}`;
|
||||
},
|
||||
alertParamsExpression: (props: Props) => (
|
||||
<Expression {...props} paramDetails={ALERT_DETAILS[ALERT_LARGE_SHARD_SIZE].paramDetails} />
|
||||
<Expression {...props} paramDetails={RULE_DETAILS[RULE_LARGE_SHARD_SIZE].paramDetails} />
|
||||
),
|
||||
validate,
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,16 +11,16 @@ import { EuiTextColor, EuiSpacer } from '@elastic/eui';
|
|||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
|
||||
import {
|
||||
LEGACY_ALERTS,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
LEGACY_RULES,
|
||||
LEGACY_RULE_DETAILS,
|
||||
RULE_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
|
||||
export function createLegacyAlertTypes(): AlertTypeModel[] {
|
||||
return LEGACY_ALERTS.map((legacyAlert) => {
|
||||
return LEGACY_RULES.map((legacyAlert) => {
|
||||
return {
|
||||
id: legacyAlert,
|
||||
description: LEGACY_ALERT_DETAILS[legacyAlert].description,
|
||||
description: LEGACY_RULE_DETAILS[legacyAlert].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaClusterAlerts}`;
|
||||
|
@ -38,7 +38,7 @@ export function createLegacyAlertTypes(): AlertTypeModel[] {
|
|||
),
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
validate: () => ({ errors: {} }),
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
} from '../../../common/constants';
|
||||
import { AlertSeverity } from '../../../common/enums';
|
||||
import { getAlertPanelsByCategory } from './get_alert_panels_by_category';
|
||||
import {
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MEMORY_USAGE,
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MEMORY_USAGE,
|
||||
} from '../../../common/constants';
|
||||
import { AlertExecutionStatusValues } from '../../../../alerting/common';
|
||||
import { AlertState } from '../../../common/types/alerts';
|
||||
|
@ -93,7 +93,7 @@ describe('getAlertPanelsByCategory', () => {
|
|||
|
||||
return {
|
||||
states,
|
||||
rawAlert: {
|
||||
sanitizedRule: {
|
||||
alertTypeId: type,
|
||||
name: `${type}_label`,
|
||||
...mockAlert,
|
||||
|
@ -107,32 +107,32 @@ describe('getAlertPanelsByCategory', () => {
|
|||
describe('non setup mode', () => {
|
||||
it('should properly group for alerts in each category', () => {
|
||||
const alerts = [
|
||||
getAlert(ALERT_NODES_CHANGED, 2),
|
||||
getAlert(ALERT_DISK_USAGE, 1),
|
||||
getAlert(ALERT_LICENSE_EXPIRATION, 2),
|
||||
getAlert(RULE_NODES_CHANGED, 2),
|
||||
getAlert(RULE_DISK_USAGE, 1),
|
||||
getAlert(RULE_LICENSE_EXPIRATION, 2),
|
||||
];
|
||||
const result = getAlertPanelsByCategory(panelTitle, false, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should properly group for alerts in a single category', () => {
|
||||
const alerts = [getAlert(ALERT_MEMORY_USAGE, 2)];
|
||||
const alerts = [getAlert(RULE_MEMORY_USAGE, 2)];
|
||||
const result = getAlertPanelsByCategory(panelTitle, false, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should not show any alert if none are firing', () => {
|
||||
const alerts = [
|
||||
getAlert(ALERT_LOGSTASH_VERSION_MISMATCH, 0),
|
||||
getAlert(ALERT_CPU_USAGE, 0),
|
||||
getAlert(ALERT_THREAD_POOL_WRITE_REJECTIONS, 0),
|
||||
getAlert(RULE_LOGSTASH_VERSION_MISMATCH, 0),
|
||||
getAlert(RULE_CPU_USAGE, 0),
|
||||
getAlert(RULE_THREAD_POOL_WRITE_REJECTIONS, 0),
|
||||
];
|
||||
const result = getAlertPanelsByCategory(panelTitle, false, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should allow for state filtering', () => {
|
||||
const alerts = [getAlert(ALERT_CPU_USAGE, 2)];
|
||||
const alerts = [getAlert(RULE_CPU_USAGE, 2)];
|
||||
const customStateFilter = (state: AlertState) => state.nodeName === 'es_name_0';
|
||||
const result = getAlertPanelsByCategory(panelTitle, false, alerts, customStateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
|
@ -142,25 +142,25 @@ describe('getAlertPanelsByCategory', () => {
|
|||
describe('setup mode', () => {
|
||||
it('should properly group for alerts in each category', () => {
|
||||
const alerts = [
|
||||
getAlert(ALERT_NODES_CHANGED, 2),
|
||||
getAlert(ALERT_DISK_USAGE, 1),
|
||||
getAlert(ALERT_LICENSE_EXPIRATION, 2),
|
||||
getAlert(RULE_NODES_CHANGED, 2),
|
||||
getAlert(RULE_DISK_USAGE, 1),
|
||||
getAlert(RULE_LICENSE_EXPIRATION, 2),
|
||||
];
|
||||
const result = getAlertPanelsByCategory(panelTitle, true, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should properly group for alerts in a single category', () => {
|
||||
const alerts = [getAlert(ALERT_MEMORY_USAGE, 2)];
|
||||
const alerts = [getAlert(RULE_MEMORY_USAGE, 2)];
|
||||
const result = getAlertPanelsByCategory(panelTitle, true, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should still show alerts if none are firing', () => {
|
||||
const alerts = [
|
||||
getAlert(ALERT_LOGSTASH_VERSION_MISMATCH, 0),
|
||||
getAlert(ALERT_CPU_USAGE, 0),
|
||||
getAlert(ALERT_THREAD_POOL_WRITE_REJECTIONS, 0),
|
||||
getAlert(RULE_LOGSTASH_VERSION_MISMATCH, 0),
|
||||
getAlert(RULE_CPU_USAGE, 0),
|
||||
getAlert(RULE_THREAD_POOL_WRITE_REJECTIONS, 0),
|
||||
];
|
||||
const result = getAlertPanelsByCategory(panelTitle, true, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import React, { Fragment } from 'react';
|
||||
import { EuiText, EuiToolTip } from '@elastic/eui';
|
||||
import { AlertPanel } from '../panel';
|
||||
import { ALERT_PANEL_MENU } from '../../../common/constants';
|
||||
import { RULE_PANEL_MENU } from '../../../common/constants';
|
||||
import { getDateFromNow, getCalendar } from '../../../common/formatting';
|
||||
import {
|
||||
AlertState,
|
||||
|
@ -22,7 +22,7 @@ import { Legacy } from '../../legacy_shims';
|
|||
|
||||
interface MenuAlert {
|
||||
alert: CommonAlert;
|
||||
alertName: string;
|
||||
ruleName: string;
|
||||
states: CommonAlertState[];
|
||||
}
|
||||
interface MenuItem {
|
||||
|
@ -36,13 +36,13 @@ export function getAlertPanelsByCategory(
|
|||
alerts: CommonAlertStatus[],
|
||||
stateFilter: (state: AlertState) => boolean
|
||||
) {
|
||||
// return items organized by categories in ALERT_PANEL_MENU
|
||||
// return items organized by categories in RULE_PANEL_MENU
|
||||
// only show rules in setup mode
|
||||
const menu = inSetupMode
|
||||
? ALERT_PANEL_MENU.reduce<MenuItem[]>((acc, category) => {
|
||||
? RULE_PANEL_MENU.reduce<MenuItem[]>((acc, category) => {
|
||||
// check if we have any rules with that match this category
|
||||
const alertsInCategory = category.alerts.filter((alert) =>
|
||||
alerts.find(({ rawAlert }) => rawAlert.alertTypeId === alert.alertName)
|
||||
const alertsInCategory = category.rules.filter((rule) =>
|
||||
alerts.find(({ sanitizedRule }) => sanitizedRule.alertTypeId === rule.ruleName)
|
||||
);
|
||||
// return all the categories that have rules and the rules
|
||||
if (alertsInCategory.length > 0) {
|
||||
|
@ -51,14 +51,14 @@ export function getAlertPanelsByCategory(
|
|||
...category,
|
||||
// add the corresponding rules that belong to this category
|
||||
alerts: alertsInCategory
|
||||
.map(({ alertName }) => {
|
||||
.map(({ ruleName }) => {
|
||||
return alerts
|
||||
.filter(({ rawAlert }) => rawAlert.alertTypeId === alertName)
|
||||
.filter(({ sanitizedRule }) => sanitizedRule.alertTypeId === ruleName)
|
||||
.map((alert) => {
|
||||
return {
|
||||
alert: alert.rawAlert,
|
||||
alert: alert.sanitizedRule,
|
||||
states: [],
|
||||
alertName,
|
||||
ruleName,
|
||||
};
|
||||
});
|
||||
})
|
||||
|
@ -68,13 +68,14 @@ export function getAlertPanelsByCategory(
|
|||
}
|
||||
return acc;
|
||||
}, [])
|
||||
: ALERT_PANEL_MENU.reduce<MenuItem[]>((acc, category) => {
|
||||
// return items organized by categories in ALERT_PANEL_MENU, then rule name, then the actual alerts
|
||||
: RULE_PANEL_MENU.reduce<MenuItem[]>((acc, category) => {
|
||||
// return items organized by categories in RULE_PANEL_MENU, then rule name, then the actual alerts
|
||||
const firingAlertsInCategory: MenuAlert[] = [];
|
||||
let categoryFiringAlertCount = 0;
|
||||
for (const { alertName } of category.alerts) {
|
||||
for (const { ruleName } of category.rules) {
|
||||
const foundAlerts = alerts.filter(
|
||||
({ rawAlert, states }) => alertName === rawAlert.alertTypeId && states.length > 0
|
||||
({ sanitizedRule, states }) =>
|
||||
ruleName === sanitizedRule.alertTypeId && states.length > 0
|
||||
);
|
||||
if (foundAlerts.length > 0) {
|
||||
foundAlerts.forEach((foundAlert) => {
|
||||
|
@ -82,9 +83,9 @@ export function getAlertPanelsByCategory(
|
|||
const states = foundAlert.states.filter(({ state }) => stateFilter(state));
|
||||
if (states.length > 0) {
|
||||
firingAlertsInCategory.push({
|
||||
alert: foundAlert.rawAlert,
|
||||
alert: foundAlert.sanitizedRule,
|
||||
states,
|
||||
alertName,
|
||||
ruleName,
|
||||
});
|
||||
categoryFiringAlertCount += states.length;
|
||||
}
|
||||
|
@ -169,7 +170,7 @@ export function getAlertPanelsByCategory(
|
|||
panels.push({
|
||||
id: nodeIndex + 1,
|
||||
title: `${category.label}`,
|
||||
items: category.alerts.map(({ alert, alertName, states }) => {
|
||||
items: category.alerts.map(({ alert, ruleName, states }) => {
|
||||
const filteredStates = states.filter(({ state }) => stateFilter(state));
|
||||
const name = inSetupMode ? (
|
||||
<EuiText>{alert.name}</EuiText>
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
} from '../../../common/constants';
|
||||
import { AlertSeverity } from '../../../common/enums';
|
||||
import { getAlertPanelsByNode } from './get_alert_panels_by_node';
|
||||
import {
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MEMORY_USAGE,
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MEMORY_USAGE,
|
||||
} from '../../../common/constants';
|
||||
import { AlertExecutionStatusValues } from '../../../../alerting/common';
|
||||
import { AlertState } from '../../../common/types/alerts';
|
||||
|
@ -88,7 +88,7 @@ describe('getAlertPanelsByNode', () => {
|
|||
}
|
||||
|
||||
return {
|
||||
rawAlert: {
|
||||
sanitizedRule: {
|
||||
id: `${type}_${firingCount}`,
|
||||
alertTypeId: type,
|
||||
name: `${type}_label`,
|
||||
|
@ -103,17 +103,17 @@ describe('getAlertPanelsByNode', () => {
|
|||
|
||||
it('should properly group for alerts in each category', () => {
|
||||
const alerts = [
|
||||
getAlert(ALERT_NODES_CHANGED, 2),
|
||||
getAlert(ALERT_DISK_USAGE, 1),
|
||||
getAlert(ALERT_LICENSE_EXPIRATION, 2),
|
||||
getAlert(RULE_NODES_CHANGED, 2),
|
||||
getAlert(RULE_DISK_USAGE, 1),
|
||||
getAlert(RULE_LICENSE_EXPIRATION, 2),
|
||||
{
|
||||
states: [
|
||||
{ firing: true, meta: {}, state: { cluster, ui, nodeId: 'es1', nodeName: 'es_name_1' } },
|
||||
],
|
||||
rawAlert: {
|
||||
id: `${ALERT_NODES_CHANGED}_3`,
|
||||
alertTypeId: ALERT_NODES_CHANGED,
|
||||
name: `${ALERT_NODES_CHANGED}_label_2`,
|
||||
sanitizedRule: {
|
||||
id: `${RULE_NODES_CHANGED}_3`,
|
||||
alertTypeId: RULE_NODES_CHANGED,
|
||||
name: `${RULE_NODES_CHANGED}_label_2`,
|
||||
...mockAlert,
|
||||
},
|
||||
},
|
||||
|
@ -123,16 +123,16 @@ describe('getAlertPanelsByNode', () => {
|
|||
});
|
||||
|
||||
it('should properly group for alerts in a single category', () => {
|
||||
const alerts = [getAlert(ALERT_MEMORY_USAGE, 2)];
|
||||
const alerts = [getAlert(RULE_MEMORY_USAGE, 2)];
|
||||
const result = getAlertPanelsByNode(panelTitle, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should not show any alert if none are firing', () => {
|
||||
const alerts = [
|
||||
getAlert(ALERT_LOGSTASH_VERSION_MISMATCH, 0),
|
||||
getAlert(ALERT_CPU_USAGE, 0),
|
||||
getAlert(ALERT_THREAD_POOL_WRITE_REJECTIONS, 0),
|
||||
getAlert(RULE_LOGSTASH_VERSION_MISMATCH, 0),
|
||||
getAlert(RULE_CPU_USAGE, 0),
|
||||
getAlert(RULE_THREAD_POOL_WRITE_REJECTIONS, 0),
|
||||
];
|
||||
const result = getAlertPanelsByNode(panelTitle, alerts, stateFilter);
|
||||
expect(result).toMatchSnapshot();
|
||||
|
|
|
@ -37,8 +37,8 @@ export function getAlertPanelsByNode(
|
|||
[uuid: string]: CommonAlertState[];
|
||||
} = {};
|
||||
|
||||
for (const { states, rawAlert } of alerts) {
|
||||
const { id: alertId } = rawAlert;
|
||||
for (const { states, sanitizedRule } of alerts) {
|
||||
const { id: alertId } = sanitizedRule;
|
||||
for (const alertState of states.filter(({ state: _state }) => stateFilter(_state))) {
|
||||
const { state } = alertState;
|
||||
statesByNodes[state.nodeId] = statesByNodes[state.nodeId] || [];
|
||||
|
@ -46,7 +46,7 @@ export function getAlertPanelsByNode(
|
|||
|
||||
alertsByNodes[state.nodeId] = alertsByNodes[state.nodeId] || {};
|
||||
alertsByNodes[state.nodeId][alertId] = alertsByNodes[alertState.state.nodeId][alertId] || {
|
||||
alert: rawAlert,
|
||||
alert: sanitizedRule,
|
||||
states: [],
|
||||
count: 0,
|
||||
};
|
||||
|
|
|
@ -12,24 +12,24 @@ import { Expression, Props } from '../components/param_details_form/expression';
|
|||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
|
||||
import {
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_DETAILS,
|
||||
RULE_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
|
||||
export function createMemoryUsageAlertType(): AlertTypeModel<MonitoringAlertTypeParams> {
|
||||
return {
|
||||
id: ALERT_MEMORY_USAGE,
|
||||
description: ALERT_DETAILS[ALERT_MEMORY_USAGE].description,
|
||||
id: RULE_MEMORY_USAGE,
|
||||
description: RULE_DETAILS[RULE_MEMORY_USAGE].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaJvmThreshold}`;
|
||||
},
|
||||
alertParamsExpression: (props: Props) => (
|
||||
<Expression {...props} paramDetails={ALERT_DETAILS[ALERT_MEMORY_USAGE].paramDetails} />
|
||||
<Expression {...props} paramDetails={RULE_DETAILS[RULE_MEMORY_USAGE].paramDetails} />
|
||||
),
|
||||
validate,
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,16 +10,16 @@ import React from 'react';
|
|||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
|
||||
import { validate } from './validation';
|
||||
import {
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_DETAILS,
|
||||
ALERT_REQUIRES_APP_CONTEXT,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_DETAILS,
|
||||
RULE_REQUIRES_APP_CONTEXT,
|
||||
} from '../../../common/constants';
|
||||
import { Expression } from './expression';
|
||||
|
||||
export function createMissingMonitoringDataAlertType(): AlertTypeModel {
|
||||
return {
|
||||
id: ALERT_MISSING_MONITORING_DATA,
|
||||
description: ALERT_DETAILS[ALERT_MISSING_MONITORING_DATA].description,
|
||||
id: RULE_MISSING_MONITORING_DATA,
|
||||
description: RULE_DETAILS[RULE_MISSING_MONITORING_DATA].description,
|
||||
iconClass: 'bell',
|
||||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.monitoring.alertsKibanaMissingData}`;
|
||||
|
@ -27,11 +27,11 @@ export function createMissingMonitoringDataAlertType(): AlertTypeModel {
|
|||
alertParamsExpression: (props: any) => (
|
||||
<Expression
|
||||
{...props}
|
||||
paramDetails={ALERT_DETAILS[ALERT_MISSING_MONITORING_DATA].paramDetails}
|
||||
paramDetails={RULE_DETAILS[RULE_MISSING_MONITORING_DATA].paramDetails}
|
||||
/>
|
||||
),
|
||||
validate,
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import { Expression, Props } from '../components/param_details_form/expression';
|
|||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
|
||||
import { CommonAlertParamDetails } from '../../../common/types/alerts';
|
||||
import { ALERT_REQUIRES_APP_CONTEXT } from '../../../common/constants';
|
||||
import { RULE_REQUIRES_APP_CONTEXT } from '../../../common/constants';
|
||||
|
||||
interface ThreadPoolTypes {
|
||||
[key: string]: unknown;
|
||||
|
@ -61,6 +61,6 @@ export function createThreadPoolRejectionsAlertType(
|
|||
return { errors };
|
||||
},
|
||||
defaultActionMessage: '{{context.internalFullMessage}}',
|
||||
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
|
||||
requiresAppContext: RULE_REQUIRES_APP_CONTEXT,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -38,18 +38,18 @@ import { SetupModeTooltip } from '../../setup_mode/tooltip';
|
|||
import { getSafeForExternalLink } from '../../../lib/get_safe_for_external_link';
|
||||
import {
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_CLUSTER_HEALTH,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
} from '../../../../common/constants';
|
||||
import { AlertsBadge } from '../../../alerts/badge';
|
||||
import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badge';
|
||||
|
@ -162,24 +162,24 @@ function renderLog(log) {
|
|||
);
|
||||
}
|
||||
|
||||
const OVERVIEW_PANEL_ALERTS = [
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
const OVERVIEW_PANEL_RULES = [
|
||||
RULE_CLUSTER_HEALTH,
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
];
|
||||
|
||||
const NODES_PANEL_ALERTS = [
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
const NODES_PANEL_RULES = [
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
];
|
||||
|
||||
const INDICES_PANEL_ALERTS = [ALERT_LARGE_SHARD_SIZE];
|
||||
const INDICES_PANEL_RULES = [RULE_LARGE_SHARD_SIZE];
|
||||
|
||||
export function ElasticsearchPanel(props) {
|
||||
const clusterStats = props.cluster_stats || {};
|
||||
|
@ -286,8 +286,8 @@ export function ElasticsearchPanel(props) {
|
|||
};
|
||||
|
||||
let nodesAlertStatus = null;
|
||||
if (shouldShowAlertBadge(alerts, NODES_PANEL_ALERTS, setupModeContext)) {
|
||||
const alertsList = NODES_PANEL_ALERTS.map((alertType) => alerts[alertType]);
|
||||
if (shouldShowAlertBadge(alerts, NODES_PANEL_RULES, setupModeContext)) {
|
||||
const alertsList = NODES_PANEL_RULES.map((alertType) => alerts[alertType]);
|
||||
nodesAlertStatus = (
|
||||
<EuiFlexItem grow={false}>
|
||||
<AlertsBadge alerts={alertsList} />
|
||||
|
@ -296,8 +296,8 @@ export function ElasticsearchPanel(props) {
|
|||
}
|
||||
|
||||
let overviewAlertStatus = null;
|
||||
if (shouldShowAlertBadge(alerts, OVERVIEW_PANEL_ALERTS, setupModeContext)) {
|
||||
const alertsList = OVERVIEW_PANEL_ALERTS.map((alertType) => alerts[alertType]);
|
||||
if (shouldShowAlertBadge(alerts, OVERVIEW_PANEL_RULES, setupModeContext)) {
|
||||
const alertsList = OVERVIEW_PANEL_RULES.map((alertType) => alerts[alertType]);
|
||||
overviewAlertStatus = (
|
||||
<EuiFlexItem grow={false}>
|
||||
<AlertsBadge alerts={alertsList} />
|
||||
|
@ -306,8 +306,8 @@ export function ElasticsearchPanel(props) {
|
|||
}
|
||||
|
||||
let indicesAlertStatus = null;
|
||||
if (shouldShowAlertBadge(alerts, INDICES_PANEL_ALERTS, setupModeContext)) {
|
||||
const alertsList = INDICES_PANEL_ALERTS.map((alertType) => alerts[alertType]);
|
||||
if (shouldShowAlertBadge(alerts, INDICES_PANEL_RULES, setupModeContext)) {
|
||||
const alertsList = INDICES_PANEL_RULES.map((alertType) => alerts[alertType]);
|
||||
indicesAlertStatus = (
|
||||
<EuiFlexItem grow={false}>
|
||||
<AlertsBadge alerts={alertsList} />
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { SetupModeTooltip } from '../../setup_mode/tooltip';
|
||||
import { KIBANA_SYSTEM_ID, ALERT_KIBANA_VERSION_MISMATCH } from '../../../../common/constants';
|
||||
import { KIBANA_SYSTEM_ID, RULE_KIBANA_VERSION_MISMATCH } from '../../../../common/constants';
|
||||
import { getSafeForExternalLink } from '../../../lib/get_safe_for_external_link';
|
||||
import { AlertsBadge } from '../../../alerts/badge';
|
||||
import { shouldShowAlertBadge } from '../../../alerts/lib/should_show_alert_badge';
|
||||
|
@ -37,7 +37,7 @@ import { isSetupModeFeatureEnabled } from '../../../lib/setup_mode';
|
|||
import { SetupModeFeature } from '../../../../common/enums';
|
||||
import { SetupModeContext } from '../../setup_mode/setup_mode_context';
|
||||
|
||||
const INSTANCES_PANEL_ALERTS = [ALERT_KIBANA_VERSION_MISMATCH];
|
||||
const INSTANCES_PANEL_ALERTS = [RULE_KIBANA_VERSION_MISMATCH];
|
||||
|
||||
export function KibanaPanel(props) {
|
||||
const setupMode = props.setupMode;
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
import {
|
||||
LOGSTASH,
|
||||
LOGSTASH_SYSTEM_ID,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
} from '../../../../common/constants';
|
||||
|
||||
import {
|
||||
|
@ -42,7 +42,7 @@ import { isSetupModeFeatureEnabled } from '../../../lib/setup_mode';
|
|||
import { SetupModeFeature } from '../../../../common/enums';
|
||||
import { SetupModeContext } from '../../setup_mode/setup_mode_context';
|
||||
|
||||
const NODES_PANEL_ALERTS = [ALERT_LOGSTASH_VERSION_MISMATCH];
|
||||
const NODES_PANEL_RULES = [RULE_LOGSTASH_VERSION_MISMATCH];
|
||||
|
||||
export function LogstashPanel(props) {
|
||||
const { setupMode } = props;
|
||||
|
@ -72,8 +72,8 @@ export function LogstashPanel(props) {
|
|||
) : null;
|
||||
|
||||
let nodesAlertStatus = null;
|
||||
if (shouldShowAlertBadge(alerts, NODES_PANEL_ALERTS, setupModeContext)) {
|
||||
const alertsList = NODES_PANEL_ALERTS.map((alertType) => alerts[alertType]);
|
||||
if (shouldShowAlertBadge(alerts, NODES_PANEL_RULES, setupModeContext)) {
|
||||
const alertsList = NODES_PANEL_RULES.map((alertType) => alerts[alertType]);
|
||||
nodesAlertStatus = (
|
||||
<EuiFlexItem grow={false}>
|
||||
<AlertsBadge alerts={alertsList} />
|
||||
|
|
|
@ -23,9 +23,9 @@ import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
|
|||
import { MonitoringStartPluginDependencies, MonitoringConfig } from './types';
|
||||
import { TriggersAndActionsUIPublicPluginSetup } from '../../triggers_actions_ui/public';
|
||||
import {
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_DETAILS,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_DETAILS,
|
||||
} from '../common/constants';
|
||||
import { createCpuUsageAlertType } from './alerts/cpu_usage_alert';
|
||||
import { createMissingMonitoringDataAlertType } from './alerts/missing_monitoring_data_alert';
|
||||
|
@ -176,14 +176,14 @@ export class MonitoringPlugin
|
|||
ruleTypeRegistry.register(createMissingMonitoringDataAlertType());
|
||||
ruleTypeRegistry.register(
|
||||
createThreadPoolRejectionsAlertType(
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_DETAILS[ALERT_THREAD_POOL_SEARCH_REJECTIONS]
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_DETAILS[RULE_THREAD_POOL_SEARCH_REJECTIONS]
|
||||
)
|
||||
);
|
||||
ruleTypeRegistry.register(
|
||||
createThreadPoolRejectionsAlertType(
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_DETAILS[ALERT_THREAD_POOL_WRITE_REJECTIONS]
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_DETAILS[RULE_THREAD_POOL_WRITE_REJECTIONS]
|
||||
)
|
||||
);
|
||||
ruleTypeRegistry.register(createCCRReadExceptionsAlertType());
|
||||
|
|
|
@ -15,7 +15,7 @@ import { Ccr } from '../../../components/elasticsearch/ccr';
|
|||
import { MonitoringViewBaseController } from '../../base_controller';
|
||||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
} from '../../../../common/constants';
|
||||
import { SetupModeRenderer } from '../../../components/renderers';
|
||||
|
@ -47,7 +47,7 @@ uiRoutes.when('/elasticsearch/ccr', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_CCR_READ_EXCEPTIONS],
|
||||
alertTypeIds: [RULE_CCR_READ_EXCEPTIONS],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ import { MonitoringViewBaseController } from '../../../base_controller';
|
|||
import { CcrShard } from '../../../../components/elasticsearch/ccr_shard';
|
||||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
} from '../../../../../common/constants';
|
||||
import { SetupModeRenderer } from '../../../../components/renderers';
|
||||
|
@ -46,7 +46,7 @@ uiRoutes.when('/elasticsearch/ccr/:index/shard/:shardId', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_CCR_READ_EXCEPTIONS],
|
||||
alertTypeIds: [RULE_CCR_READ_EXCEPTIONS],
|
||||
filters: [
|
||||
{
|
||||
shardId: $route.current.pathParams.shardId,
|
||||
|
|
|
@ -19,7 +19,7 @@ import { AdvancedIndex } from '../../../../components/elasticsearch/index/advanc
|
|||
import { MonitoringViewBaseController } from '../../../base_controller';
|
||||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
} from '../../../../../common/constants';
|
||||
import { SetupModeContext } from '../../../../components/setup_mode/setup_mode_context';
|
||||
|
@ -80,7 +80,7 @@ uiRoutes.when('/elasticsearch/indices/:index/advanced', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_LARGE_SHARD_SIZE],
|
||||
alertTypeIds: [RULE_LARGE_SHARD_SIZE],
|
||||
filters: [
|
||||
{
|
||||
shardIndex: $route.current.pathParams.index,
|
||||
|
|
|
@ -21,7 +21,7 @@ import { Index } from '../../../components/elasticsearch/index/index';
|
|||
import { MonitoringViewBaseController } from '../../base_controller';
|
||||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
} from '../../../../common/constants';
|
||||
import { SetupModeContext } from '../../../components/setup_mode/setup_mode_context';
|
||||
|
@ -88,7 +88,7 @@ uiRoutes.when('/elasticsearch/indices/:index', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_LARGE_SHARD_SIZE],
|
||||
alertTypeIds: [RULE_LARGE_SHARD_SIZE],
|
||||
filters: [
|
||||
{
|
||||
shardIndex: $route.current.pathParams.index,
|
||||
|
|
|
@ -16,7 +16,7 @@ import template from './index.html';
|
|||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
} from '../../../../common/constants';
|
||||
import { SetupModeRenderer } from '../../../components/renderers';
|
||||
import { SetupModeContext } from '../../../components/setup_mode/setup_mode_context';
|
||||
|
@ -60,7 +60,7 @@ uiRoutes.when('/elasticsearch/indices', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_LARGE_SHARD_SIZE],
|
||||
alertTypeIds: [RULE_LARGE_SHARD_SIZE],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -20,12 +20,12 @@ import { AdvancedNode } from '../../../../components/elasticsearch/node/advanced
|
|||
import { MonitoringViewBaseController } from '../../../base_controller';
|
||||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MEMORY_USAGE,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MEMORY_USAGE,
|
||||
} from '../../../../../common/constants';
|
||||
|
||||
function getPageData($injector) {
|
||||
|
@ -77,12 +77,12 @@ uiRoutes.when('/elasticsearch/nodes/:node/advanced', {
|
|||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
],
|
||||
filters: [
|
||||
{
|
||||
|
|
|
@ -22,12 +22,12 @@ import { nodesByIndices } from '../../../components/elasticsearch/shard_allocati
|
|||
import { MonitoringViewBaseController } from '../../base_controller';
|
||||
import {
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MEMORY_USAGE,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MEMORY_USAGE,
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
} from '../../../../common/constants';
|
||||
import { SetupModeContext } from '../../../components/setup_mode/setup_mode_context';
|
||||
|
@ -64,12 +64,12 @@ uiRoutes.when('/elasticsearch/nodes/:node', {
|
|||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
],
|
||||
filters: [
|
||||
{
|
||||
|
|
|
@ -19,12 +19,12 @@ import { SetupModeRenderer } from '../../../components/renderers';
|
|||
import {
|
||||
ELASTICSEARCH_SYSTEM_ID,
|
||||
CODE_PATH_ELASTICSEARCH,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MEMORY_USAGE,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MEMORY_USAGE,
|
||||
} from '../../../../common/constants';
|
||||
import { SetupModeContext } from '../../../components/setup_mode/setup_mode_context';
|
||||
|
||||
|
@ -94,12 +94,12 @@ uiRoutes.when('/elasticsearch/nodes', {
|
|||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ import {
|
|||
import { MonitoringTimeseriesContainer } from '../../../components/chart';
|
||||
import { DetailStatus } from '../../../components/kibana/detail_status';
|
||||
import { MonitoringViewBaseController } from '../../base_controller';
|
||||
import { CODE_PATH_KIBANA, ALERT_KIBANA_VERSION_MISMATCH } from '../../../../common/constants';
|
||||
import { CODE_PATH_KIBANA, RULE_KIBANA_VERSION_MISMATCH } from '../../../../common/constants';
|
||||
import { AlertsCallout } from '../../../alerts/callout';
|
||||
|
||||
function getPageData($injector) {
|
||||
|
@ -77,7 +77,7 @@ uiRoutes.when('/kibana/instances/:uuid', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_KIBANA_VERSION_MISMATCH],
|
||||
alertTypeIds: [RULE_KIBANA_VERSION_MISMATCH],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ import { SetupModeContext } from '../../../components/setup_mode/setup_mode_cont
|
|||
import {
|
||||
KIBANA_SYSTEM_ID,
|
||||
CODE_PATH_KIBANA,
|
||||
ALERT_KIBANA_VERSION_MISMATCH,
|
||||
RULE_KIBANA_VERSION_MISMATCH,
|
||||
} from '../../../../common/constants';
|
||||
|
||||
uiRoutes.when('/kibana/instances', {
|
||||
|
@ -48,7 +48,7 @@ uiRoutes.when('/kibana/instances', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_KIBANA_VERSION_MISMATCH],
|
||||
alertTypeIds: [RULE_KIBANA_VERSION_MISMATCH],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
import { MonitoringTimeseriesContainer } from '../../../../components/chart';
|
||||
import {
|
||||
CODE_PATH_LOGSTASH,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
} from '../../../../../common/constants';
|
||||
import { AlertsCallout } from '../../../../alerts/callout';
|
||||
|
||||
|
@ -77,7 +77,7 @@ uiRoutes.when('/logstash/node/:uuid/advanced', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_LOGSTASH_VERSION_MISMATCH],
|
||||
alertTypeIds: [RULE_LOGSTASH_VERSION_MISMATCH],
|
||||
},
|
||||
},
|
||||
telemetryPageViewTitle: 'logstash_node_advanced',
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { MonitoringTimeseriesContainer } from '../../../components/chart';
|
||||
import { MonitoringViewBaseController } from '../../base_controller';
|
||||
import { CODE_PATH_LOGSTASH, ALERT_LOGSTASH_VERSION_MISMATCH } from '../../../../common/constants';
|
||||
import { CODE_PATH_LOGSTASH, RULE_LOGSTASH_VERSION_MISMATCH } from '../../../../common/constants';
|
||||
import { AlertsCallout } from '../../../alerts/callout';
|
||||
|
||||
function getPageData($injector) {
|
||||
|
@ -74,7 +74,7 @@ uiRoutes.when('/logstash/node/:uuid', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_LOGSTASH_VERSION_MISMATCH],
|
||||
alertTypeIds: [RULE_LOGSTASH_VERSION_MISMATCH],
|
||||
},
|
||||
},
|
||||
telemetryPageViewTitle: 'logstash_node',
|
||||
|
|
|
@ -18,7 +18,7 @@ import { SetupModeContext } from '../../../components/setup_mode/setup_mode_cont
|
|||
import {
|
||||
CODE_PATH_LOGSTASH,
|
||||
LOGSTASH_SYSTEM_ID,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
} from '../../../../common/constants';
|
||||
|
||||
uiRoutes.when('/logstash/nodes', {
|
||||
|
@ -48,7 +48,7 @@ uiRoutes.when('/logstash/nodes', {
|
|||
alerts: {
|
||||
shouldFetch: true,
|
||||
options: {
|
||||
alertTypeIds: [ALERT_LOGSTASH_VERSION_MISMATCH],
|
||||
alertTypeIds: [RULE_LOGSTASH_VERSION_MISMATCH],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { AlertsFactory } from './alerts_factory';
|
||||
import { ALERT_CPU_USAGE } from '../../common/constants';
|
||||
import { RULE_CPU_USAGE } from '../../common/constants';
|
||||
|
||||
jest.mock('../static_globals', () => ({
|
||||
Globals: {
|
||||
|
@ -39,7 +39,7 @@ describe('AlertsFactory', () => {
|
|||
],
|
||||
};
|
||||
});
|
||||
const alerts = await AlertsFactory.getByType(ALERT_CPU_USAGE, rulesClient as any);
|
||||
const alerts = await AlertsFactory.getByType(RULE_CPU_USAGE, rulesClient as any);
|
||||
expect(alerts).not.toBeNull();
|
||||
expect(alerts.length).toBe(2);
|
||||
expect(alerts[0].getId()).toBe(1);
|
||||
|
@ -54,7 +54,7 @@ describe('AlertsFactory', () => {
|
|||
total: 0,
|
||||
};
|
||||
});
|
||||
await AlertsFactory.getByType(ALERT_CPU_USAGE, rulesClient as any);
|
||||
expect(filter).toBe(`alert.attributes.alertTypeId:${ALERT_CPU_USAGE}`);
|
||||
await AlertsFactory.getByType(RULE_CPU_USAGE, rulesClient as any);
|
||||
expect(filter).toBe(`alert.attributes.alertTypeId:${RULE_CPU_USAGE}`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,64 +6,64 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
LargeShardSizeAlert,
|
||||
CCRReadExceptionsAlert,
|
||||
CpuUsageAlert,
|
||||
MissingMonitoringDataAlert,
|
||||
DiskUsageAlert,
|
||||
ThreadPoolSearchRejectionsAlert,
|
||||
ThreadPoolWriteRejectionsAlert,
|
||||
MemoryUsageAlert,
|
||||
NodesChangedAlert,
|
||||
ClusterHealthAlert,
|
||||
LicenseExpirationAlert,
|
||||
LogstashVersionMismatchAlert,
|
||||
KibanaVersionMismatchAlert,
|
||||
ElasticsearchVersionMismatchAlert,
|
||||
BaseAlert,
|
||||
LargeShardSizeRule,
|
||||
CCRReadExceptionsRule,
|
||||
CpuUsageRule,
|
||||
MissingMonitoringDataRule,
|
||||
DiskUsageRule,
|
||||
ThreadPoolSearchRejectionsRule,
|
||||
ThreadPoolWriteRejectionsRule,
|
||||
MemoryUsageRule,
|
||||
NodesChangedRule,
|
||||
ClusterHealthRule,
|
||||
LicenseExpirationRule,
|
||||
LogstashVersionMismatchRule,
|
||||
KibanaVersionMismatchRule,
|
||||
ElasticsearchVersionMismatchRule,
|
||||
BaseRule,
|
||||
} from './';
|
||||
import {
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
ALERT_THREAD_POOL_WRITE_REJECTIONS,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_NODES_CHANGED,
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
ALERT_KIBANA_VERSION_MISMATCH,
|
||||
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
RULE_CLUSTER_HEALTH,
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_THREAD_POOL_SEARCH_REJECTIONS,
|
||||
RULE_THREAD_POOL_WRITE_REJECTIONS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_NODES_CHANGED,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
RULE_KIBANA_VERSION_MISMATCH,
|
||||
RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
} from '../../common/constants';
|
||||
import { RulesClient } from '../../../alerting/server';
|
||||
import { Alert } from '../../../alerting/common';
|
||||
import { CommonAlertParams } from '../../common/types/alerts';
|
||||
|
||||
const BY_TYPE = {
|
||||
[ALERT_CLUSTER_HEALTH]: ClusterHealthAlert,
|
||||
[ALERT_LICENSE_EXPIRATION]: LicenseExpirationAlert,
|
||||
[ALERT_CPU_USAGE]: CpuUsageAlert,
|
||||
[ALERT_MISSING_MONITORING_DATA]: MissingMonitoringDataAlert,
|
||||
[ALERT_DISK_USAGE]: DiskUsageAlert,
|
||||
[ALERT_THREAD_POOL_SEARCH_REJECTIONS]: ThreadPoolSearchRejectionsAlert,
|
||||
[ALERT_THREAD_POOL_WRITE_REJECTIONS]: ThreadPoolWriteRejectionsAlert,
|
||||
[ALERT_MEMORY_USAGE]: MemoryUsageAlert,
|
||||
[ALERT_NODES_CHANGED]: NodesChangedAlert,
|
||||
[ALERT_LOGSTASH_VERSION_MISMATCH]: LogstashVersionMismatchAlert,
|
||||
[ALERT_KIBANA_VERSION_MISMATCH]: KibanaVersionMismatchAlert,
|
||||
[ALERT_ELASTICSEARCH_VERSION_MISMATCH]: ElasticsearchVersionMismatchAlert,
|
||||
[ALERT_CCR_READ_EXCEPTIONS]: CCRReadExceptionsAlert,
|
||||
[ALERT_LARGE_SHARD_SIZE]: LargeShardSizeAlert,
|
||||
[RULE_CLUSTER_HEALTH]: ClusterHealthRule,
|
||||
[RULE_LICENSE_EXPIRATION]: LicenseExpirationRule,
|
||||
[RULE_CPU_USAGE]: CpuUsageRule,
|
||||
[RULE_MISSING_MONITORING_DATA]: MissingMonitoringDataRule,
|
||||
[RULE_DISK_USAGE]: DiskUsageRule,
|
||||
[RULE_THREAD_POOL_SEARCH_REJECTIONS]: ThreadPoolSearchRejectionsRule,
|
||||
[RULE_THREAD_POOL_WRITE_REJECTIONS]: ThreadPoolWriteRejectionsRule,
|
||||
[RULE_MEMORY_USAGE]: MemoryUsageRule,
|
||||
[RULE_NODES_CHANGED]: NodesChangedRule,
|
||||
[RULE_LOGSTASH_VERSION_MISMATCH]: LogstashVersionMismatchRule,
|
||||
[RULE_KIBANA_VERSION_MISMATCH]: KibanaVersionMismatchRule,
|
||||
[RULE_ELASTICSEARCH_VERSION_MISMATCH]: ElasticsearchVersionMismatchRule,
|
||||
[RULE_CCR_READ_EXCEPTIONS]: CCRReadExceptionsRule,
|
||||
[RULE_LARGE_SHARD_SIZE]: LargeShardSizeRule,
|
||||
};
|
||||
|
||||
export class AlertsFactory {
|
||||
public static async getByType(
|
||||
type: string,
|
||||
alertsClient: RulesClient | undefined
|
||||
): Promise<BaseAlert[]> {
|
||||
): Promise<BaseRule[]> {
|
||||
const alertCls = BY_TYPE[type];
|
||||
if (!alertCls || !alertsClient) {
|
||||
return [];
|
||||
|
@ -77,7 +77,7 @@ export class AlertsFactory {
|
|||
if (!alertClientAlerts.total || !alertClientAlerts.data?.length) {
|
||||
return [];
|
||||
}
|
||||
return alertClientAlerts.data.map((alert) => new alertCls(alert as Alert) as BaseAlert);
|
||||
return alertClientAlerts.data.map((alert) => new alertCls(alert as Alert) as BaseRule);
|
||||
}
|
||||
|
||||
public static getAll() {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
|
||||
jest.mock('../static_globals', () => ({
|
||||
Globals: {
|
||||
|
@ -15,10 +15,10 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('BaseAlert', () => {
|
||||
describe('BaseRule', () => {
|
||||
describe('create', () => {
|
||||
it('should create an alert if it does not exist', async () => {
|
||||
const alert = new BaseAlert();
|
||||
it('should create a rule if it does not exist', async () => {
|
||||
const rule = new BaseRule();
|
||||
const rulesClient = {
|
||||
create: jest.fn(),
|
||||
find: jest.fn().mockImplementation(() => {
|
||||
|
@ -41,7 +41,7 @@ describe('BaseAlert', () => {
|
|||
},
|
||||
];
|
||||
|
||||
await alert.createIfDoesNotExist(rulesClient as any, actionsClient as any, actions);
|
||||
await rule.createIfDoesNotExist(rulesClient as any, actionsClient as any, actions);
|
||||
expect(rulesClient.create).toHaveBeenCalledWith({
|
||||
data: {
|
||||
actions: [
|
||||
|
@ -71,8 +71,8 @@ describe('BaseAlert', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should not create an alert if it exists', async () => {
|
||||
const alert = new BaseAlert();
|
||||
it('should not create a rule if it exists', async () => {
|
||||
const rule = new BaseRule();
|
||||
const rulesClient = {
|
||||
create: jest.fn(),
|
||||
find: jest.fn().mockImplementation(() => {
|
||||
|
@ -96,7 +96,7 @@ describe('BaseAlert', () => {
|
|||
},
|
||||
];
|
||||
|
||||
await alert.createIfDoesNotExist(rulesClient as any, actionsClient as any, actions);
|
||||
await rule.createIfDoesNotExist(rulesClient as any, actionsClient as any, actions);
|
||||
expect(rulesClient.create).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -116,8 +116,8 @@ describe('BaseAlert', () => {
|
|||
};
|
||||
const id = '456def';
|
||||
const filters: any[] = [];
|
||||
const alert = new BaseAlert();
|
||||
const states = await alert.getStates(rulesClient as any, id, filters);
|
||||
const rule = new BaseRule();
|
||||
const states = await rule.getStates(rulesClient as any, id, filters);
|
||||
expect(states).toStrictEqual({
|
||||
abc123: {
|
||||
id: 'foobar',
|
||||
|
@ -133,8 +133,8 @@ describe('BaseAlert', () => {
|
|||
};
|
||||
const id = '456def';
|
||||
const filters: any[] = [];
|
||||
const alert = new BaseAlert();
|
||||
const states = await alert.getStates(rulesClient as any, id, filters);
|
||||
const rule = new BaseRule();
|
||||
const states = await rule.getStates(rulesClient as any, id, filters);
|
||||
expect(states).toStrictEqual({});
|
||||
});
|
||||
});
|
|
@ -44,7 +44,7 @@ type ExecutedState =
|
|||
}
|
||||
| Record<string, any>;
|
||||
|
||||
interface AlertOptions {
|
||||
interface RuleOptions {
|
||||
id: string;
|
||||
name: string;
|
||||
throttle?: string | null;
|
||||
|
@ -55,7 +55,7 @@ interface AlertOptions {
|
|||
accessorKey?: string;
|
||||
}
|
||||
|
||||
const defaultAlertOptions = (): AlertOptions => {
|
||||
const defaultRuleOptions = (): RuleOptions => {
|
||||
return {
|
||||
id: '',
|
||||
name: '',
|
||||
|
@ -65,24 +65,24 @@ const defaultAlertOptions = (): AlertOptions => {
|
|||
actionVariables: [],
|
||||
};
|
||||
};
|
||||
export class BaseAlert {
|
||||
export class BaseRule {
|
||||
protected scopedLogger: Logger;
|
||||
|
||||
constructor(
|
||||
public rawAlert?: SanitizedAlert,
|
||||
public alertOptions: AlertOptions = defaultAlertOptions()
|
||||
public sanitizedRule?: SanitizedAlert,
|
||||
public ruleOptions: RuleOptions = defaultRuleOptions()
|
||||
) {
|
||||
const defaultOptions = defaultAlertOptions();
|
||||
const defaultOptions = defaultRuleOptions();
|
||||
defaultOptions.defaultParams = {
|
||||
...defaultOptions.defaultParams,
|
||||
...this.alertOptions.defaultParams,
|
||||
...this.ruleOptions.defaultParams,
|
||||
};
|
||||
this.alertOptions = { ...defaultOptions, ...this.alertOptions };
|
||||
this.scopedLogger = Globals.app.getLogger(alertOptions.id);
|
||||
this.ruleOptions = { ...defaultOptions, ...this.ruleOptions };
|
||||
this.scopedLogger = Globals.app.getLogger(ruleOptions.id);
|
||||
}
|
||||
|
||||
public getAlertType(): AlertType<never, never, never, never, never, 'default'> {
|
||||
const { id, name, actionVariables } = this.alertOptions;
|
||||
public getRuleType(): AlertType<never, never, never, never, never, 'default'> {
|
||||
const { id, name, actionVariables } = this.ruleOptions;
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
|
@ -110,7 +110,7 @@ export class BaseAlert {
|
|||
}
|
||||
|
||||
public getId() {
|
||||
return this.rawAlert?.id;
|
||||
return this.sanitizedRule?.id;
|
||||
}
|
||||
|
||||
public async createIfDoesNotExist(
|
||||
|
@ -118,24 +118,24 @@ export class BaseAlert {
|
|||
actionsClient: ActionsClient,
|
||||
actions: AlertEnableAction[]
|
||||
): Promise<SanitizedAlert<AlertTypeParams>> {
|
||||
const existingAlertData = await rulesClient.find({
|
||||
const existingRuleData = await rulesClient.find({
|
||||
options: {
|
||||
search: this.alertOptions.id,
|
||||
search: this.ruleOptions.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (existingAlertData.total > 0) {
|
||||
const existingAlert = existingAlertData.data[0] as Alert;
|
||||
return existingAlert;
|
||||
if (existingRuleData.total > 0) {
|
||||
const existingRule = existingRuleData.data[0] as Alert;
|
||||
return existingRule;
|
||||
}
|
||||
|
||||
const alertActions = [];
|
||||
const ruleActions = [];
|
||||
for (const actionData of actions) {
|
||||
const action = await actionsClient.get({ id: actionData.id });
|
||||
if (!action) {
|
||||
continue;
|
||||
}
|
||||
alertActions.push({
|
||||
ruleActions.push({
|
||||
group: 'default',
|
||||
id: actionData.id,
|
||||
params: {
|
||||
|
@ -151,7 +151,7 @@ export class BaseAlert {
|
|||
id: alertTypeId,
|
||||
throttle = '1d',
|
||||
interval = '1m',
|
||||
} = this.alertOptions;
|
||||
} = this.ruleOptions;
|
||||
return await rulesClient.create<AlertTypeParams>({
|
||||
data: {
|
||||
enabled: true,
|
||||
|
@ -163,7 +163,7 @@ export class BaseAlert {
|
|||
throttle,
|
||||
notifyWhen: null,
|
||||
schedule: { interval },
|
||||
actions: alertActions,
|
||||
actions: ruleActions,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -247,11 +247,11 @@ export class BaseAlert {
|
|||
return await fetchClusters(esClient, esIndexPattern);
|
||||
}
|
||||
const limit = parseDuration(params.limit);
|
||||
const rangeFilter = this.alertOptions.fetchClustersRange
|
||||
const rangeFilter = this.ruleOptions.fetchClustersRange
|
||||
? {
|
||||
timestamp: {
|
||||
format: 'epoch_millis',
|
||||
gte: +new Date() - limit - this.alertOptions.fetchClustersRange,
|
||||
gte: +new Date() - limit - this.ruleOptions.fetchClustersRange,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
|
@ -281,7 +281,7 @@ export class BaseAlert {
|
|||
continue;
|
||||
}
|
||||
|
||||
const key = this.alertOptions.accessorKey;
|
||||
const key = this.ruleOptions.accessorKey;
|
||||
|
||||
// for each node, update the alert's state with node state
|
||||
for (const node of nodes) {
|
|
@ -5,13 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CCRReadExceptionsAlert } from './ccr_read_exceptions_alert';
|
||||
import { ALERT_CCR_READ_EXCEPTIONS } from '../../common/constants';
|
||||
import { CCRReadExceptionsRule } from './ccr_read_exceptions_rule';
|
||||
import { RULE_CCR_READ_EXCEPTIONS } from '../../common/constants';
|
||||
import { fetchCCRReadExceptions } from '../lib/alerts/fetch_ccr_read_exceptions';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
||||
type ICCRReadExceptionsAlertMock = CCRReadExceptionsAlert & {
|
||||
type ICCRReadExceptionsRuleMock = CCRReadExceptionsRule & {
|
||||
defaultParams: {
|
||||
duration: string;
|
||||
};
|
||||
|
@ -47,16 +47,16 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('CCRReadExceptionsAlert', () => {
|
||||
describe('CCRReadExceptionsRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new CCRReadExceptionsAlert() as ICCRReadExceptionsAlertMock;
|
||||
expect(alert.alertOptions.id).toBe(ALERT_CCR_READ_EXCEPTIONS);
|
||||
expect(alert.alertOptions.name).toBe('CCR read exceptions');
|
||||
expect(alert.alertOptions.throttle).toBe('6h');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({
|
||||
const rule = new CCRReadExceptionsRule() as ICCRReadExceptionsRuleMock;
|
||||
expect(rule.ruleOptions.id).toBe(RULE_CCR_READ_EXCEPTIONS);
|
||||
expect(rule.ruleOptions.name).toBe('CCR read exceptions');
|
||||
expect(rule.ruleOptions.throttle).toBe('6h');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({
|
||||
duration: '1h',
|
||||
});
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{
|
||||
name: 'remoteCluster',
|
||||
description: 'The remote cluster experiencing CCR read exceptions.',
|
||||
|
@ -146,11 +146,11 @@ describe('CCRReadExceptionsAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new CCRReadExceptionsAlert() as ICCRReadExceptionsAlertMock;
|
||||
const type = alert.getAlertType();
|
||||
const rule = new CCRReadExceptionsRule() as ICCRReadExceptionsRuleMock;
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
||||
internalFullMessage: `CCR read exceptions alert is firing for the following remote cluster: ${remoteCluster}. Current 'follower_index' index affected: ${followerIndex}. [View CCR stats](http://localhost:5601/app/monitoring#/elasticsearch/ccr?_g=(cluster_uuid:${clusterUuid}))`,
|
||||
|
@ -177,11 +177,11 @@ describe('CCRReadExceptionsAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new CCRReadExceptionsAlert() as ICCRReadExceptionsAlertMock;
|
||||
const type = alert.getAlertType();
|
||||
const rule = new CCRReadExceptionsRule() as ICCRReadExceptionsRuleMock;
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
||||
internalFullMessage: `CCR read exceptions alert is firing for the following remote cluster: ${remoteCluster}. Current 'follower_index' index affected: ${followerIndex}. [View CCR stats](http://localhost:5601/app/monitoring#/elasticsearch/ccr?_g=(cluster_uuid:${clusterUuid},ccs:testCluster))`,
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -24,8 +24,8 @@ import {
|
|||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
ALERT_CCR_READ_EXCEPTIONS,
|
||||
ALERT_DETAILS,
|
||||
RULE_CCR_READ_EXCEPTIONS,
|
||||
RULE_DETAILS,
|
||||
} from '../../common/constants';
|
||||
import { fetchCCRReadExceptions } from '../lib/alerts/fetch_ccr_read_exceptions';
|
||||
import { getCcsIndexPattern } from '../lib/alerts/get_ccs_index_pattern';
|
||||
|
@ -36,11 +36,11 @@ import { AlertingDefaults, createLink } from './alert_helpers';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { Globals } from '../static_globals';
|
||||
|
||||
export class CCRReadExceptionsAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_CCR_READ_EXCEPTIONS,
|
||||
name: ALERT_DETAILS[ALERT_CCR_READ_EXCEPTIONS].label,
|
||||
export class CCRReadExceptionsRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_CCR_READ_EXCEPTIONS,
|
||||
name: RULE_DETAILS[RULE_CCR_READ_EXCEPTIONS].label,
|
||||
throttle: '6h',
|
||||
defaultParams: {
|
||||
duration: '1h',
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ClusterHealthAlert } from './cluster_health_alert';
|
||||
import { ALERT_CLUSTER_HEALTH } from '../../common/constants';
|
||||
import { ClusterHealthRule } from './cluster_health_rule';
|
||||
import { RULE_CLUSTER_HEALTH } from '../../common/constants';
|
||||
import { AlertClusterHealthType, AlertSeverity } from '../../common/enums';
|
||||
import { fetchClusterHealth } from '../lib/alerts/fetch_cluster_health';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
|
@ -35,13 +35,13 @@ jest.mock('../lib/alerts/fetch_clusters', () => ({
|
|||
fetchClusters: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('ClusterHealthAlert', () => {
|
||||
describe('ClusterHealthRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new ClusterHealthAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_CLUSTER_HEALTH);
|
||||
expect(alert.alertOptions.name).toBe('Cluster health');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new ClusterHealthRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_CLUSTER_HEALTH);
|
||||
expect(rule.ruleOptions.name).toBe('Cluster health');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'clusterHealth', description: 'The health of the cluster.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -112,8 +112,8 @@ describe('ClusterHealthAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new ClusterHealthAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ClusterHealthRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: {},
|
||||
|
@ -179,8 +179,8 @@ describe('ClusterHealthAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new ClusterHealthAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ClusterHealthRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: {},
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -20,8 +20,8 @@ import {
|
|||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
RULE_CLUSTER_HEALTH,
|
||||
LEGACY_RULE_DETAILS,
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
} from '../../common/constants';
|
||||
import { AlertMessageTokenType, AlertClusterHealthType, AlertSeverity } from '../../common/enums';
|
||||
|
@ -43,11 +43,11 @@ const YELLOW_STATUS_MESSAGE = i18n.translate(
|
|||
}
|
||||
);
|
||||
|
||||
export class ClusterHealthAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_CLUSTER_HEALTH,
|
||||
name: LEGACY_ALERT_DETAILS[ALERT_CLUSTER_HEALTH].label,
|
||||
export class ClusterHealthRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_CLUSTER_HEALTH,
|
||||
name: LEGACY_RULE_DETAILS[RULE_CLUSTER_HEALTH].label,
|
||||
actionVariables: [
|
||||
{
|
||||
name: 'clusterHealth',
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CpuUsageAlert } from './cpu_usage_alert';
|
||||
import { ALERT_CPU_USAGE } from '../../common/constants';
|
||||
import { CpuUsageRule } from './cpu_usage_rule';
|
||||
import { RULE_CPU_USAGE } from '../../common/constants';
|
||||
import { fetchCpuUsageNodeStats } from '../lib/alerts/fetch_cpu_usage_node_stats';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -35,14 +35,14 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('CpuUsageAlert', () => {
|
||||
describe('CpuUsageRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new CpuUsageAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_CPU_USAGE);
|
||||
expect(alert.alertOptions.name).toBe('CPU Usage');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({ threshold: 85, duration: '5m' });
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new CpuUsageRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_CPU_USAGE);
|
||||
expect(rule.ruleOptions.name).toBe('CPU Usage');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({ threshold: 85, duration: '5m' });
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'node', description: 'The node reporting high cpu usage.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -114,11 +114,11 @@ describe('CpuUsageAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new CpuUsageAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new CpuUsageRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
|
@ -211,11 +211,11 @@ describe('CpuUsageAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new CpuUsageAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new CpuUsageRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [],
|
||||
|
@ -233,11 +233,11 @@ describe('CpuUsageAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new CpuUsageAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new CpuUsageRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
|
@ -8,7 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import numeral from '@elastic/numeral';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -23,11 +23,7 @@ import {
|
|||
CommonAlertFilter,
|
||||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DETAILS,
|
||||
} from '../../common/constants';
|
||||
import { INDEX_PATTERN_ELASTICSEARCH, RULE_CPU_USAGE, RULE_DETAILS } from '../../common/constants';
|
||||
// @ts-ignore
|
||||
import { ROUNDED_FLOAT } from '../../common/formatting';
|
||||
import { fetchCpuUsageNodeStats } from '../lib/alerts/fetch_cpu_usage_node_stats';
|
||||
|
@ -39,11 +35,11 @@ import { AlertingDefaults, createLink } from './alert_helpers';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { Globals } from '../static_globals';
|
||||
|
||||
export class CpuUsageAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_CPU_USAGE,
|
||||
name: ALERT_DETAILS[ALERT_CPU_USAGE].label,
|
||||
export class CpuUsageRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_CPU_USAGE,
|
||||
name: RULE_DETAILS[RULE_CPU_USAGE].label,
|
||||
accessorKey: 'cpuUsage',
|
||||
defaultParams: {
|
||||
threshold: 85,
|
|
@ -5,13 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { DiskUsageAlert } from './disk_usage_alert';
|
||||
import { ALERT_DISK_USAGE } from '../../common/constants';
|
||||
import { DiskUsageRule } from './disk_usage_rule';
|
||||
import { RULE_DISK_USAGE } from '../../common/constants';
|
||||
import { fetchDiskUsageNodeStats } from '../lib/alerts/fetch_disk_usage_node_stats';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
||||
type IDiskUsageAlertMock = DiskUsageAlert & {
|
||||
type IDiskUsageAlertMock = DiskUsageRule & {
|
||||
defaultParams: {
|
||||
threshold: number;
|
||||
duration: string;
|
||||
|
@ -48,14 +48,14 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('DiskUsageAlert', () => {
|
||||
describe('DiskUsageRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new DiskUsageAlert() as IDiskUsageAlertMock;
|
||||
expect(alert.alertOptions.id).toBe(ALERT_DISK_USAGE);
|
||||
expect(alert.alertOptions.name).toBe('Disk Usage');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({ threshold: 80, duration: '5m' });
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const alert = new DiskUsageRule() as IDiskUsageAlertMock;
|
||||
expect(alert.ruleOptions.id).toBe(RULE_DISK_USAGE);
|
||||
expect(alert.ruleOptions.name).toBe('Disk Usage');
|
||||
expect(alert.ruleOptions.throttle).toBe('1d');
|
||||
expect(alert.ruleOptions.defaultParams).toStrictEqual({ threshold: 80, duration: '5m' });
|
||||
expect(alert.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'node', description: 'The node reporting high disk usage.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -126,11 +126,11 @@ describe('DiskUsageAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new DiskUsageAlert() as IDiskUsageAlertMock;
|
||||
const type = alert.getAlertType();
|
||||
const rule = new DiskUsageRule() as IDiskUsageAlertMock;
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
||||
|
@ -156,11 +156,11 @@ describe('DiskUsageAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new DiskUsageAlert() as IDiskUsageAlertMock;
|
||||
const type = alert.getAlertType();
|
||||
const rule = new DiskUsageRule() as IDiskUsageAlertMock;
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
|
@ -8,7 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import numeral from '@elastic/numeral';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -23,11 +23,7 @@ import {
|
|||
CommonAlertFilter,
|
||||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_DETAILS,
|
||||
} from '../../common/constants';
|
||||
import { INDEX_PATTERN_ELASTICSEARCH, RULE_DISK_USAGE, RULE_DETAILS } from '../../common/constants';
|
||||
// @ts-ignore
|
||||
import { ROUNDED_FLOAT } from '../../common/formatting';
|
||||
import { fetchDiskUsageNodeStats } from '../lib/alerts/fetch_disk_usage_node_stats';
|
||||
|
@ -38,11 +34,11 @@ import { AlertingDefaults, createLink } from './alert_helpers';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { Globals } from '../static_globals';
|
||||
|
||||
export class DiskUsageAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_DISK_USAGE,
|
||||
name: ALERT_DETAILS[ALERT_DISK_USAGE].label,
|
||||
export class DiskUsageRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_DISK_USAGE,
|
||||
name: RULE_DETAILS[RULE_DISK_USAGE].label,
|
||||
accessorKey: 'diskUsage',
|
||||
defaultParams: {
|
||||
threshold: 80,
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ElasticsearchVersionMismatchAlert } from './elasticsearch_version_mismatch_alert';
|
||||
import { ALERT_ELASTICSEARCH_VERSION_MISMATCH } from '../../common/constants';
|
||||
import { ElasticsearchVersionMismatchRule } from './elasticsearch_version_mismatch_rule';
|
||||
import { RULE_ELASTICSEARCH_VERSION_MISMATCH } from '../../common/constants';
|
||||
import { fetchElasticsearchVersions } from '../lib/alerts/fetch_elasticsearch_versions';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -38,11 +38,11 @@ jest.mock('../static_globals', () => ({
|
|||
|
||||
describe('ElasticsearchVersionMismatchAlert', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new ElasticsearchVersionMismatchAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_ELASTICSEARCH_VERSION_MISMATCH);
|
||||
expect(alert.alertOptions.name).toBe('Elasticsearch version mismatch');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new ElasticsearchVersionMismatchRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_ELASTICSEARCH_VERSION_MISMATCH);
|
||||
expect(rule.ruleOptions.name).toBe('Elasticsearch version mismatch');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{
|
||||
name: 'versionList',
|
||||
description: 'The versions of Elasticsearch running in this cluster.',
|
||||
|
@ -116,12 +116,12 @@ describe('ElasticsearchVersionMismatchAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new ElasticsearchVersionMismatchAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ElasticsearchVersionMismatchRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -170,12 +170,12 @@ describe('ElasticsearchVersionMismatchAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new ElasticsearchVersionMismatchAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ElasticsearchVersionMismatchRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).not.toHaveBeenCalledWith({});
|
||||
expect(scheduleActions).not.toHaveBeenCalled();
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -19,8 +19,8 @@ import {
|
|||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
LEGACY_RULE_DETAILS,
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
} from '../../common/constants';
|
||||
import { AlertSeverity } from '../../common/enums';
|
||||
|
@ -31,11 +31,11 @@ import { getCcsIndexPattern } from '../lib/alerts/get_ccs_index_pattern';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { fetchElasticsearchVersions } from '../lib/alerts/fetch_elasticsearch_versions';
|
||||
|
||||
export class ElasticsearchVersionMismatchAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
name: LEGACY_ALERT_DETAILS[ALERT_ELASTICSEARCH_VERSION_MISMATCH].label,
|
||||
export class ElasticsearchVersionMismatchRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_ELASTICSEARCH_VERSION_MISMATCH,
|
||||
name: LEGACY_RULE_DETAILS[RULE_ELASTICSEARCH_VERSION_MISMATCH].label,
|
||||
interval: '1d',
|
||||
actionVariables: [
|
||||
{
|
|
@ -5,19 +5,19 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export { LargeShardSizeAlert } from './large_shard_size_alert';
|
||||
export { CCRReadExceptionsAlert } from './ccr_read_exceptions_alert';
|
||||
export { BaseAlert } from './base_alert';
|
||||
export { CpuUsageAlert } from './cpu_usage_alert';
|
||||
export { MissingMonitoringDataAlert } from './missing_monitoring_data_alert';
|
||||
export { DiskUsageAlert } from './disk_usage_alert';
|
||||
export { ThreadPoolSearchRejectionsAlert } from './thread_pool_search_rejections_alert';
|
||||
export { ThreadPoolWriteRejectionsAlert } from './thread_pool_write_rejections_alert';
|
||||
export { MemoryUsageAlert } from './memory_usage_alert';
|
||||
export { ClusterHealthAlert } from './cluster_health_alert';
|
||||
export { LicenseExpirationAlert } from './license_expiration_alert';
|
||||
export { NodesChangedAlert } from './nodes_changed_alert';
|
||||
export { ElasticsearchVersionMismatchAlert } from './elasticsearch_version_mismatch_alert';
|
||||
export { KibanaVersionMismatchAlert } from './kibana_version_mismatch_alert';
|
||||
export { LogstashVersionMismatchAlert } from './logstash_version_mismatch_alert';
|
||||
export { LargeShardSizeRule } from './large_shard_size_rule';
|
||||
export { CCRReadExceptionsRule } from './ccr_read_exceptions_rule';
|
||||
export { BaseRule } from './base_rule';
|
||||
export { CpuUsageRule } from './cpu_usage_rule';
|
||||
export { MissingMonitoringDataRule } from './missing_monitoring_data_rule';
|
||||
export { DiskUsageRule } from './disk_usage_rule';
|
||||
export { ThreadPoolSearchRejectionsRule } from './thread_pool_search_rejections_rule';
|
||||
export { ThreadPoolWriteRejectionsRule } from './thread_pool_write_rejections_rule';
|
||||
export { MemoryUsageRule } from './memory_usage_rule';
|
||||
export { ClusterHealthRule } from './cluster_health_rule';
|
||||
export { LicenseExpirationRule } from './license_expiration_rule';
|
||||
export { NodesChangedRule } from './nodes_changed_rule';
|
||||
export { ElasticsearchVersionMismatchRule } from './elasticsearch_version_mismatch_rule';
|
||||
export { KibanaVersionMismatchRule } from './kibana_version_mismatch_rule';
|
||||
export { LogstashVersionMismatchRule } from './logstash_version_mismatch_rule';
|
||||
export { AlertsFactory } from './alerts_factory';
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { KibanaVersionMismatchAlert } from './kibana_version_mismatch_alert';
|
||||
import { ALERT_KIBANA_VERSION_MISMATCH } from '../../common/constants';
|
||||
import { KibanaVersionMismatchRule } from './kibana_version_mismatch_rule';
|
||||
import { RULE_KIBANA_VERSION_MISMATCH } from '../../common/constants';
|
||||
import { fetchKibanaVersions } from '../lib/alerts/fetch_kibana_versions';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -36,13 +36,13 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('KibanaVersionMismatchAlert', () => {
|
||||
describe('KibanaVersionMismatchRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new KibanaVersionMismatchAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_KIBANA_VERSION_MISMATCH);
|
||||
expect(alert.alertOptions.name).toBe('Kibana version mismatch');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new KibanaVersionMismatchRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_KIBANA_VERSION_MISMATCH);
|
||||
expect(rule.ruleOptions.name).toBe('Kibana version mismatch');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{
|
||||
name: 'versionList',
|
||||
description: 'The versions of Kibana running in this cluster.',
|
||||
|
@ -119,11 +119,11 @@ describe('KibanaVersionMismatchAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new KibanaVersionMismatchAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new KibanaVersionMismatchRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -172,11 +172,11 @@ describe('KibanaVersionMismatchAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new KibanaVersionMismatchAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new KibanaVersionMismatchRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).not.toHaveBeenCalledWith({});
|
||||
expect(scheduleActions).not.toHaveBeenCalled();
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -19,8 +19,8 @@ import {
|
|||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
ALERT_KIBANA_VERSION_MISMATCH,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
RULE_KIBANA_VERSION_MISMATCH,
|
||||
LEGACY_RULE_DETAILS,
|
||||
INDEX_PATTERN_KIBANA,
|
||||
} from '../../common/constants';
|
||||
import { AlertSeverity } from '../../common/enums';
|
||||
|
@ -31,11 +31,11 @@ import { getCcsIndexPattern } from '../lib/alerts/get_ccs_index_pattern';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { fetchKibanaVersions } from '../lib/alerts/fetch_kibana_versions';
|
||||
|
||||
export class KibanaVersionMismatchAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_KIBANA_VERSION_MISMATCH,
|
||||
name: LEGACY_ALERT_DETAILS[ALERT_KIBANA_VERSION_MISMATCH].label,
|
||||
export class KibanaVersionMismatchRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_KIBANA_VERSION_MISMATCH,
|
||||
name: LEGACY_RULE_DETAILS[RULE_KIBANA_VERSION_MISMATCH].label,
|
||||
interval: '1d',
|
||||
actionVariables: [
|
||||
{
|
|
@ -5,13 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LargeShardSizeAlert } from './large_shard_size_alert';
|
||||
import { ALERT_LARGE_SHARD_SIZE } from '../../common/constants';
|
||||
import { LargeShardSizeRule } from './large_shard_size_rule';
|
||||
import { RULE_LARGE_SHARD_SIZE } from '../../common/constants';
|
||||
import { fetchIndexShardSize } from '../lib/alerts/fetch_index_shard_size';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
||||
type ILargeShardSizeAlertMock = LargeShardSizeAlert & {
|
||||
type ILargeShardSizeRuleMock = LargeShardSizeRule & {
|
||||
defaultParams: {
|
||||
threshold: number;
|
||||
duration: string;
|
||||
|
@ -48,17 +48,17 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('LargeShardSizeAlert', () => {
|
||||
describe('LargeShardSizeRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new LargeShardSizeAlert() as ILargeShardSizeAlertMock;
|
||||
expect(alert.alertOptions.id).toBe(ALERT_LARGE_SHARD_SIZE);
|
||||
expect(alert.alertOptions.name).toBe('Shard size');
|
||||
expect(alert.alertOptions.throttle).toBe('12h');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({
|
||||
const rule = new LargeShardSizeRule() as ILargeShardSizeRuleMock;
|
||||
expect(rule.ruleOptions.id).toBe(RULE_LARGE_SHARD_SIZE);
|
||||
expect(rule.ruleOptions.name).toBe('Shard size');
|
||||
expect(rule.ruleOptions.throttle).toBe('12h');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({
|
||||
threshold: 55,
|
||||
indexPattern: '-.*',
|
||||
});
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'shardIndex', description: 'The index experiencing large average shard size.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -130,11 +130,11 @@ describe('LargeShardSizeAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new LargeShardSizeAlert() as ILargeShardSizeAlertMock;
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LargeShardSizeRule() as ILargeShardSizeRuleMock;
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
||||
internalFullMessage: `Large shard size alert is firing for the following index: ${shardIndex}. [View index shard size stats](http://localhost:5601/app/monitoring#/elasticsearch/indices/${shardIndex}?_g=(cluster_uuid:${clusterUuid}))`,
|
||||
|
@ -158,11 +158,11 @@ describe('LargeShardSizeAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new LargeShardSizeAlert() as ILargeShardSizeAlertMock;
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LargeShardSizeRule() as ILargeShardSizeRuleMock;
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
||||
internalFullMessage: `Large shard size alert is firing for the following index: ${shardIndex}. [View index shard size stats](http://localhost:5601/app/monitoring#/elasticsearch/indices/${shardIndex}?_g=(cluster_uuid:${clusterUuid},ccs:testCluster))`,
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -24,8 +24,8 @@ import {
|
|||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
ALERT_LARGE_SHARD_SIZE,
|
||||
ALERT_DETAILS,
|
||||
RULE_LARGE_SHARD_SIZE,
|
||||
RULE_DETAILS,
|
||||
} from '../../common/constants';
|
||||
import { fetchIndexShardSize } from '../lib/alerts/fetch_index_shard_size';
|
||||
import { getCcsIndexPattern } from '../lib/alerts/get_ccs_index_pattern';
|
||||
|
@ -35,11 +35,11 @@ import { AlertingDefaults, createLink } from './alert_helpers';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { Globals } from '../static_globals';
|
||||
|
||||
export class LargeShardSizeAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_LARGE_SHARD_SIZE,
|
||||
name: ALERT_DETAILS[ALERT_LARGE_SHARD_SIZE].label,
|
||||
export class LargeShardSizeRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_LARGE_SHARD_SIZE,
|
||||
name: RULE_DETAILS[RULE_LARGE_SHARD_SIZE].label,
|
||||
throttle: '12h',
|
||||
defaultParams: { indexPattern: '-.*', threshold: 55 },
|
||||
actionVariables: [
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LicenseExpirationAlert } from './license_expiration_alert';
|
||||
import { ALERT_LICENSE_EXPIRATION } from '../../common/constants';
|
||||
import { LicenseExpirationRule } from './license_expiration_rule';
|
||||
import { RULE_LICENSE_EXPIRATION } from '../../common/constants';
|
||||
import { AlertSeverity } from '../../common/enums';
|
||||
import { fetchLicenses } from '../lib/alerts/fetch_licenses';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
|
@ -42,13 +42,13 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('LicenseExpirationAlert', () => {
|
||||
describe('LicenseExpirationRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new LicenseExpirationAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_LICENSE_EXPIRATION);
|
||||
expect(alert.alertOptions.name).toBe('License expiration');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new LicenseExpirationRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_LICENSE_EXPIRATION);
|
||||
expect(rule.ruleOptions.name).toBe('License expiration');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'expiredDate', description: 'The date when the license expires.' },
|
||||
{ name: 'clusterName', description: 'The cluster to which the license belong.' },
|
||||
{
|
||||
|
@ -117,11 +117,11 @@ describe('LicenseExpirationAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new LicenseExpirationAlert();
|
||||
const type = alert.getAlertType();
|
||||
const alert = new LicenseExpirationRule();
|
||||
const type = alert.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: alert.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -196,12 +196,12 @@ describe('LicenseExpirationAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new LicenseExpirationAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LicenseExpirationRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).not.toHaveBeenCalledWith({});
|
||||
expect(scheduleActions).not.toHaveBeenCalled();
|
||||
|
@ -218,12 +218,12 @@ describe('LicenseExpirationAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new LicenseExpirationAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LicenseExpirationRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState.mock.calls[0][0].alertStates[0].ui.severity).toBe(AlertSeverity.Danger);
|
||||
});
|
||||
|
@ -239,12 +239,12 @@ describe('LicenseExpirationAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new LicenseExpirationAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LicenseExpirationRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState.mock.calls[0][0].alertStates[0].ui.severity).toBe(AlertSeverity.Warning);
|
||||
});
|
|
@ -7,7 +7,7 @@
|
|||
import moment from 'moment';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -22,8 +22,8 @@ import {
|
|||
} from '../../common/types/alerts';
|
||||
import { AlertExecutorOptions, AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
ALERT_LICENSE_EXPIRATION,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
RULE_LICENSE_EXPIRATION,
|
||||
LEGACY_RULE_DETAILS,
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
} from '../../common/constants';
|
||||
import { AlertMessageTokenType, AlertSeverity } from '../../common/enums';
|
||||
|
@ -36,11 +36,11 @@ import { fetchLicenses } from '../lib/alerts/fetch_licenses';
|
|||
|
||||
const EXPIRES_DAYS = [60, 30, 14, 7];
|
||||
|
||||
export class LicenseExpirationAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_LICENSE_EXPIRATION,
|
||||
name: LEGACY_ALERT_DETAILS[ALERT_LICENSE_EXPIRATION].label,
|
||||
export class LicenseExpirationRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_LICENSE_EXPIRATION,
|
||||
name: LEGACY_RULE_DETAILS[RULE_LICENSE_EXPIRATION].label,
|
||||
interval: '1d',
|
||||
actionVariables: [
|
||||
{
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LogstashVersionMismatchAlert } from './logstash_version_mismatch_alert';
|
||||
import { ALERT_LOGSTASH_VERSION_MISMATCH } from '../../common/constants';
|
||||
import { LogstashVersionMismatchRule } from './logstash_version_mismatch_rule';
|
||||
import { RULE_LOGSTASH_VERSION_MISMATCH } from '../../common/constants';
|
||||
import { fetchLogstashVersions } from '../lib/alerts/fetch_logstash_versions';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -37,13 +37,13 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('LogstashVersionMismatchAlert', () => {
|
||||
describe('LogstashVersionMismatchRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new LogstashVersionMismatchAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_LOGSTASH_VERSION_MISMATCH);
|
||||
expect(alert.alertOptions.name).toBe('Logstash version mismatch');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new LogstashVersionMismatchRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_LOGSTASH_VERSION_MISMATCH);
|
||||
expect(rule.ruleOptions.name).toBe('Logstash version mismatch');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{
|
||||
name: 'versionList',
|
||||
description: 'The versions of Logstash running in this cluster.',
|
||||
|
@ -117,12 +117,12 @@ describe('LogstashVersionMismatchAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new LogstashVersionMismatchAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LogstashVersionMismatchRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -171,12 +171,12 @@ describe('LogstashVersionMismatchAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new LogstashVersionMismatchAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new LogstashVersionMismatchRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).not.toHaveBeenCalledWith({});
|
||||
expect(scheduleActions).not.toHaveBeenCalled();
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -19,8 +19,8 @@ import {
|
|||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
LEGACY_RULE_DETAILS,
|
||||
INDEX_PATTERN_LOGSTASH,
|
||||
} from '../../common/constants';
|
||||
import { AlertSeverity } from '../../common/enums';
|
||||
|
@ -31,11 +31,11 @@ import { getCcsIndexPattern } from '../lib/alerts/get_ccs_index_pattern';
|
|||
import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
||||
import { fetchLogstashVersions } from '../lib/alerts/fetch_logstash_versions';
|
||||
|
||||
export class LogstashVersionMismatchAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_LOGSTASH_VERSION_MISMATCH,
|
||||
name: LEGACY_ALERT_DETAILS[ALERT_LOGSTASH_VERSION_MISMATCH].label,
|
||||
export class LogstashVersionMismatchRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_LOGSTASH_VERSION_MISMATCH,
|
||||
name: LEGACY_RULE_DETAILS[RULE_LOGSTASH_VERSION_MISMATCH].label,
|
||||
interval: '1d',
|
||||
actionVariables: [
|
||||
{
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { MemoryUsageAlert } from './memory_usage_alert';
|
||||
import { ALERT_MEMORY_USAGE } from '../../common/constants';
|
||||
import { MemoryUsageRule } from './memory_usage_rule';
|
||||
import { RULE_MEMORY_USAGE } from '../../common/constants';
|
||||
import { fetchMemoryUsageNodeStats } from '../lib/alerts/fetch_memory_usage_node_stats';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -35,14 +35,14 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('MemoryUsageAlert', () => {
|
||||
describe('MemoryUsageRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new MemoryUsageAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_MEMORY_USAGE);
|
||||
expect(alert.alertOptions.name).toBe('Memory Usage (JVM)');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({ threshold: 85, duration: '5m' });
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new MemoryUsageRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_MEMORY_USAGE);
|
||||
expect(rule.ruleOptions.name).toBe('Memory Usage (JVM)');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({ threshold: 85, duration: '5m' });
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'node', description: 'The node reporting high memory usage.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -114,11 +114,11 @@ describe('MemoryUsageAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new MemoryUsageAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new MemoryUsageRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
|
@ -245,11 +245,11 @@ describe('MemoryUsageAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new MemoryUsageAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new MemoryUsageRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [],
|
||||
|
@ -267,11 +267,11 @@ describe('MemoryUsageAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new MemoryUsageAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new MemoryUsageRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
|
@ -8,7 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import numeral from '@elastic/numeral';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -25,8 +25,8 @@ import {
|
|||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
ALERT_MEMORY_USAGE,
|
||||
ALERT_DETAILS,
|
||||
RULE_MEMORY_USAGE,
|
||||
RULE_DETAILS,
|
||||
} from '../../common/constants';
|
||||
// @ts-ignore
|
||||
import { ROUNDED_FLOAT } from '../../common/formatting';
|
||||
|
@ -39,11 +39,11 @@ import { appendMetricbeatIndex } from '../lib/alerts/append_mb_index';
|
|||
import { parseDuration } from '../../../alerting/common/parse_duration';
|
||||
import { Globals } from '../static_globals';
|
||||
|
||||
export class MemoryUsageAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_MEMORY_USAGE,
|
||||
name: ALERT_DETAILS[ALERT_MEMORY_USAGE].label,
|
||||
export class MemoryUsageRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_MEMORY_USAGE,
|
||||
name: RULE_DETAILS[RULE_MEMORY_USAGE].label,
|
||||
accessorKey: 'memoryUsage',
|
||||
defaultParams: {
|
||||
threshold: 85,
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { MissingMonitoringDataAlert } from './missing_monitoring_data_alert';
|
||||
import { ALERT_MISSING_MONITORING_DATA } from '../../common/constants';
|
||||
import { MissingMonitoringDataRule } from './missing_monitoring_data_rule';
|
||||
import { RULE_MISSING_MONITORING_DATA } from '../../common/constants';
|
||||
import { fetchMissingMonitoringData } from '../lib/alerts/fetch_missing_monitoring_data';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -37,14 +37,14 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('MissingMonitoringDataAlert', () => {
|
||||
describe('MissingMonitoringDataRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new MissingMonitoringDataAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_MISSING_MONITORING_DATA);
|
||||
expect(alert.alertOptions.name).toBe('Missing monitoring data');
|
||||
expect(alert.alertOptions.throttle).toBe('6h');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({ limit: '1d', duration: '15m' });
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new MissingMonitoringDataRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_MISSING_MONITORING_DATA);
|
||||
expect(rule.ruleOptions.name).toBe('Missing monitoring data');
|
||||
expect(rule.ruleOptions.throttle).toBe('6h');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({ limit: '1d', duration: '15m' });
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'node', description: 'The node missing monitoring data.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -118,11 +118,11 @@ describe('MissingMonitoringDataAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new MissingMonitoringDataAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new MissingMonitoringDataRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
|
@ -202,12 +202,12 @@ describe('MissingMonitoringDataAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new MissingMonitoringDataAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new MissingMonitoringDataRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [],
|
||||
|
@ -225,12 +225,12 @@ describe('MissingMonitoringDataAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new MissingMonitoringDataAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new MissingMonitoringDataRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
|
@ -8,7 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import moment from 'moment';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -20,11 +20,7 @@ import {
|
|||
AlertNodeState,
|
||||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
INDEX_PATTERN,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
ALERT_DETAILS,
|
||||
} from '../../common/constants';
|
||||
import { INDEX_PATTERN, RULE_MISSING_MONITORING_DATA, RULE_DETAILS } from '../../common/constants';
|
||||
import { getCcsIndexPattern } from '../lib/alerts/get_ccs_index_pattern';
|
||||
import { AlertMessageTokenType, AlertSeverity } from '../../common/enums';
|
||||
import { RawAlertInstance, SanitizedAlert } from '../../../alerting/common';
|
||||
|
@ -37,11 +33,11 @@ import { Globals } from '../static_globals';
|
|||
// Go a bit farther back because we need to detect the difference between seeing the monitoring data versus just not looking far enough back
|
||||
const LIMIT_BUFFER = 3 * 60 * 1000;
|
||||
|
||||
export class MissingMonitoringDataAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_MISSING_MONITORING_DATA,
|
||||
name: ALERT_DETAILS[ALERT_MISSING_MONITORING_DATA].label,
|
||||
export class MissingMonitoringDataRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_MISSING_MONITORING_DATA,
|
||||
name: RULE_DETAILS[RULE_MISSING_MONITORING_DATA].label,
|
||||
accessorKey: 'gapDuration',
|
||||
fetchClustersRange: LIMIT_BUFFER,
|
||||
defaultParams: {
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { NodesChangedAlert } from './nodes_changed_alert';
|
||||
import { ALERT_NODES_CHANGED } from '../../common/constants';
|
||||
import { NodesChangedRule } from './nodes_changed_rule';
|
||||
import { RULE_NODES_CHANGED } from '../../common/constants';
|
||||
import { fetchNodesFromClusterStats } from '../lib/alerts/fetch_nodes_from_cluster_stats';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -44,11 +44,11 @@ jest.mock('../static_globals', () => ({
|
|||
|
||||
describe('NodesChangedAlert', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new NodesChangedAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_NODES_CHANGED);
|
||||
expect(alert.alertOptions.name).toBe('Nodes changed');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new NodesChangedRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_NODES_CHANGED);
|
||||
expect(rule.ruleOptions.name).toBe('Nodes changed');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'added', description: 'The list of nodes added to the cluster.' },
|
||||
{ name: 'removed', description: 'The list of nodes removed from the cluster.' },
|
||||
{ name: 'restarted', description: 'The list of nodes restarted in the cluster.' },
|
||||
|
@ -168,12 +168,12 @@ describe('NodesChangedAlert', () => {
|
|||
(fetchNodesFromClusterStats as jest.Mock).mockImplementation(() => {
|
||||
return nodesChanged;
|
||||
});
|
||||
const alert = new NodesChangedAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new NodesChangedRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -231,12 +231,12 @@ describe('NodesChangedAlert', () => {
|
|||
(fetchNodesFromClusterStats as jest.Mock).mockImplementation(() => {
|
||||
return nodesAddedChangedRemoved;
|
||||
});
|
||||
const alert = new NodesChangedAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new NodesChangedRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -325,12 +325,12 @@ describe('NodesChangedAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new NodesChangedAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new NodesChangedRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).not.toHaveBeenCalledWith({});
|
||||
expect(scheduleActions).not.toHaveBeenCalled();
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -21,8 +21,8 @@ import {
|
|||
} from '../../common/types/alerts';
|
||||
import { AlertInstance } from '../../../alerting/server';
|
||||
import {
|
||||
ALERT_NODES_CHANGED,
|
||||
LEGACY_ALERT_DETAILS,
|
||||
RULE_NODES_CHANGED,
|
||||
LEGACY_RULE_DETAILS,
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
} from '../../common/constants';
|
||||
import { AlertingDefaults } from './alert_helpers';
|
||||
|
@ -63,11 +63,11 @@ function getNodeStates(nodes: AlertClusterStatsNodes): AlertNodesChangedStates {
|
|||
};
|
||||
}
|
||||
|
||||
export class NodesChangedAlert extends BaseAlert {
|
||||
constructor(public rawAlert?: SanitizedAlert) {
|
||||
super(rawAlert, {
|
||||
id: ALERT_NODES_CHANGED,
|
||||
name: LEGACY_ALERT_DETAILS[ALERT_NODES_CHANGED].label,
|
||||
export class NodesChangedRule extends BaseRule {
|
||||
constructor(public sanitizedRule?: SanitizedAlert) {
|
||||
super(sanitizedRule, {
|
||||
id: RULE_NODES_CHANGED,
|
||||
name: LEGACY_RULE_DETAILS[RULE_NODES_CHANGED].label,
|
||||
actionVariables: [
|
||||
{
|
||||
name: 'added',
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { BaseAlert } from './base_alert';
|
||||
import { BaseRule } from './base_rule';
|
||||
import {
|
||||
AlertData,
|
||||
AlertCluster,
|
||||
|
@ -32,7 +32,7 @@ import { Globals } from '../static_globals';
|
|||
|
||||
type ActionVariables = Array<{ name: string; description: string }>;
|
||||
|
||||
export class ThreadPoolRejectionsAlertBase extends BaseAlert {
|
||||
export class ThreadPoolRejectionsRuleBase extends BaseRule {
|
||||
protected static createActionVariables(type: string) {
|
||||
return [
|
||||
{
|
||||
|
@ -50,13 +50,13 @@ export class ThreadPoolRejectionsAlertBase extends BaseAlert {
|
|||
}
|
||||
|
||||
constructor(
|
||||
rawAlert: Alert | undefined = undefined,
|
||||
sanitizedRule: Alert | undefined = undefined,
|
||||
public readonly id: string,
|
||||
public readonly threadPoolType: string,
|
||||
public readonly name: string,
|
||||
public readonly actionVariables: ActionVariables
|
||||
) {
|
||||
super(rawAlert, {
|
||||
super(sanitizedRule, {
|
||||
id,
|
||||
name,
|
||||
defaultParams: {
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ThreadPoolRejectionsAlertBase } from './thread_pool_rejections_alert_base';
|
||||
import { ALERT_THREAD_POOL_SEARCH_REJECTIONS, ALERT_DETAILS } from '../../common/constants';
|
||||
import { Alert } from '../../../alerting/common';
|
||||
|
||||
export class ThreadPoolSearchRejectionsAlert extends ThreadPoolRejectionsAlertBase {
|
||||
private static TYPE = ALERT_THREAD_POOL_SEARCH_REJECTIONS;
|
||||
private static THREAD_POOL_TYPE = 'search';
|
||||
private static readonly LABEL = ALERT_DETAILS[ALERT_THREAD_POOL_SEARCH_REJECTIONS].label;
|
||||
constructor(rawAlert?: Alert) {
|
||||
super(
|
||||
rawAlert,
|
||||
ThreadPoolSearchRejectionsAlert.TYPE,
|
||||
ThreadPoolSearchRejectionsAlert.THREAD_POOL_TYPE,
|
||||
ThreadPoolSearchRejectionsAlert.LABEL,
|
||||
ThreadPoolRejectionsAlertBase.createActionVariables(
|
||||
ThreadPoolSearchRejectionsAlert.THREAD_POOL_TYPE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ThreadPoolSearchRejectionsAlert } from './thread_pool_search_rejections_alert';
|
||||
import { ALERT_THREAD_POOL_SEARCH_REJECTIONS } from '../../common/constants';
|
||||
import { ThreadPoolSearchRejectionsRule } from './thread_pool_search_rejections_rule';
|
||||
import { RULE_THREAD_POOL_SEARCH_REJECTIONS } from '../../common/constants';
|
||||
import { fetchThreadPoolRejectionStats } from '../lib/alerts/fetch_thread_pool_rejections_stats';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -37,14 +37,14 @@ jest.mock('../static_globals', () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
describe('ThreadpoolSearchRejectionsAlert', () => {
|
||||
describe('ThreadpoolSearchRejectionsRule', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new ThreadPoolSearchRejectionsAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_THREAD_POOL_SEARCH_REJECTIONS);
|
||||
expect(alert.alertOptions.name).toBe('Thread pool search rejections');
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({ threshold: 300, duration: '5m' });
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new ThreadPoolSearchRejectionsRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_THREAD_POOL_SEARCH_REJECTIONS);
|
||||
expect(rule.ruleOptions.name).toBe('Thread pool search rejections');
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({ threshold: 300, duration: '5m' });
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'node', description: 'The node reporting high thread pool search rejections.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -120,11 +120,11 @@ describe('ThreadpoolSearchRejectionsAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new ThreadPoolSearchRejectionsAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ThreadPoolSearchRejectionsRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -251,12 +251,12 @@ describe('ThreadpoolSearchRejectionsAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new ThreadPoolSearchRejectionsAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ThreadPoolSearchRejectionsRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [],
|
||||
|
@ -274,12 +274,12 @@ describe('ThreadpoolSearchRejectionsAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new ThreadPoolSearchRejectionsAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ThreadPoolSearchRejectionsRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ThreadPoolRejectionsRuleBase } from './thread_pool_rejections_rule_base';
|
||||
import { RULE_THREAD_POOL_SEARCH_REJECTIONS, RULE_DETAILS } from '../../common/constants';
|
||||
import { Alert } from '../../../alerting/common';
|
||||
|
||||
export class ThreadPoolSearchRejectionsRule extends ThreadPoolRejectionsRuleBase {
|
||||
private static TYPE = RULE_THREAD_POOL_SEARCH_REJECTIONS;
|
||||
private static THREAD_POOL_TYPE = 'search';
|
||||
private static readonly LABEL = RULE_DETAILS[RULE_THREAD_POOL_SEARCH_REJECTIONS].label;
|
||||
constructor(sanitizedRule?: Alert) {
|
||||
super(
|
||||
sanitizedRule,
|
||||
ThreadPoolSearchRejectionsRule.TYPE,
|
||||
ThreadPoolSearchRejectionsRule.THREAD_POOL_TYPE,
|
||||
ThreadPoolSearchRejectionsRule.LABEL,
|
||||
ThreadPoolRejectionsRuleBase.createActionVariables(
|
||||
ThreadPoolSearchRejectionsRule.THREAD_POOL_TYPE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ThreadPoolRejectionsAlertBase } from './thread_pool_rejections_alert_base';
|
||||
import { ALERT_THREAD_POOL_WRITE_REJECTIONS, ALERT_DETAILS } from '../../common/constants';
|
||||
import { Alert } from '../../../alerting/common';
|
||||
|
||||
export class ThreadPoolWriteRejectionsAlert extends ThreadPoolRejectionsAlertBase {
|
||||
private static TYPE = ALERT_THREAD_POOL_WRITE_REJECTIONS;
|
||||
private static THREAD_POOL_TYPE = 'write';
|
||||
private static readonly LABEL = ALERT_DETAILS[ALERT_THREAD_POOL_WRITE_REJECTIONS].label;
|
||||
constructor(rawAlert?: Alert) {
|
||||
super(
|
||||
rawAlert,
|
||||
ThreadPoolWriteRejectionsAlert.TYPE,
|
||||
ThreadPoolWriteRejectionsAlert.THREAD_POOL_TYPE,
|
||||
ThreadPoolWriteRejectionsAlert.LABEL,
|
||||
ThreadPoolRejectionsAlertBase.createActionVariables(
|
||||
ThreadPoolWriteRejectionsAlert.THREAD_POOL_TYPE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ThreadPoolWriteRejectionsAlert } from './thread_pool_write_rejections_alert';
|
||||
import { ALERT_THREAD_POOL_WRITE_REJECTIONS } from '../../common/constants';
|
||||
import { ThreadPoolWriteRejectionsRule } from './thread_pool_write_rejections_rule';
|
||||
import { RULE_THREAD_POOL_WRITE_REJECTIONS } from '../../common/constants';
|
||||
import { fetchThreadPoolRejectionStats } from '../lib/alerts/fetch_thread_pool_rejections_stats';
|
||||
import { fetchClusters } from '../lib/alerts/fetch_clusters';
|
||||
import { elasticsearchServiceMock } from 'src/core/server/mocks';
|
||||
|
@ -39,12 +39,12 @@ jest.mock('../static_globals', () => ({
|
|||
|
||||
describe('ThreadpoolWriteRejectionsAlert', () => {
|
||||
it('should have defaults', () => {
|
||||
const alert = new ThreadPoolWriteRejectionsAlert();
|
||||
expect(alert.alertOptions.id).toBe(ALERT_THREAD_POOL_WRITE_REJECTIONS);
|
||||
expect(alert.alertOptions.name).toBe(`Thread pool write rejections`);
|
||||
expect(alert.alertOptions.throttle).toBe('1d');
|
||||
expect(alert.alertOptions.defaultParams).toStrictEqual({ threshold: 300, duration: '5m' });
|
||||
expect(alert.alertOptions.actionVariables).toStrictEqual([
|
||||
const rule = new ThreadPoolWriteRejectionsRule();
|
||||
expect(rule.ruleOptions.id).toBe(RULE_THREAD_POOL_WRITE_REJECTIONS);
|
||||
expect(rule.ruleOptions.name).toBe(`Thread pool write rejections`);
|
||||
expect(rule.ruleOptions.throttle).toBe('1d');
|
||||
expect(rule.ruleOptions.defaultParams).toStrictEqual({ threshold: 300, duration: '5m' });
|
||||
expect(rule.ruleOptions.actionVariables).toStrictEqual([
|
||||
{ name: 'node', description: 'The node reporting high thread pool write rejections.' },
|
||||
{
|
||||
name: 'internalShortMessage',
|
||||
|
@ -120,11 +120,11 @@ describe('ThreadpoolWriteRejectionsAlert', () => {
|
|||
});
|
||||
|
||||
it('should fire actions', async () => {
|
||||
const alert = new ThreadPoolWriteRejectionsAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ThreadPoolWriteRejectionsRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [
|
||||
|
@ -251,12 +251,12 @@ describe('ThreadpoolWriteRejectionsAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new ThreadPoolWriteRejectionsAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ThreadPoolWriteRejectionsRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
expect(replaceState).toHaveBeenCalledWith({
|
||||
alertStates: [],
|
||||
|
@ -274,12 +274,12 @@ describe('ThreadpoolWriteRejectionsAlert', () => {
|
|||
},
|
||||
];
|
||||
});
|
||||
const alert = new ThreadPoolWriteRejectionsAlert();
|
||||
const type = alert.getAlertType();
|
||||
const rule = new ThreadPoolWriteRejectionsRule();
|
||||
const type = rule.getRuleType();
|
||||
await type.executor({
|
||||
...executorOptions,
|
||||
// @ts-ignore
|
||||
params: alert.alertOptions.defaultParams,
|
||||
params: rule.ruleOptions.defaultParams,
|
||||
} as any);
|
||||
const count = 1;
|
||||
expect(scheduleActions).toHaveBeenCalledWith('default', {
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ThreadPoolRejectionsRuleBase } from './thread_pool_rejections_rule_base';
|
||||
import { RULE_THREAD_POOL_WRITE_REJECTIONS, RULE_DETAILS } from '../../common/constants';
|
||||
import { Alert } from '../../../alerting/common';
|
||||
|
||||
export class ThreadPoolWriteRejectionsRule extends ThreadPoolRejectionsRuleBase {
|
||||
private static TYPE = RULE_THREAD_POOL_WRITE_REJECTIONS;
|
||||
private static THREAD_POOL_TYPE = 'write';
|
||||
private static readonly LABEL = RULE_DETAILS[RULE_THREAD_POOL_WRITE_REJECTIONS].label;
|
||||
constructor(sanitizedRule?: Alert) {
|
||||
super(
|
||||
sanitizedRule,
|
||||
ThreadPoolWriteRejectionsRule.TYPE,
|
||||
ThreadPoolWriteRejectionsRule.THREAD_POOL_TYPE,
|
||||
ThreadPoolWriteRejectionsRule.LABEL,
|
||||
ThreadPoolRejectionsRuleBase.createActionVariables(
|
||||
ThreadPoolWriteRejectionsRule.THREAD_POOL_TYPE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -9,10 +9,10 @@ import { fetchStatus } from './fetch_status';
|
|||
import { AlertUiState, AlertState } from '../../../common/types/alerts';
|
||||
import { AlertSeverity } from '../../../common/enums';
|
||||
import {
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_CLUSTER_HEALTH,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_CLUSTER_HEALTH,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
} from '../../../common/constants';
|
||||
|
||||
jest.mock('../../static_globals', () => ({
|
||||
|
@ -31,7 +31,7 @@ jest.mock('../../static_globals', () => ({
|
|||
}));
|
||||
|
||||
describe('fetchStatus', () => {
|
||||
const alertType = ALERT_CPU_USAGE;
|
||||
const alertType = RULE_CPU_USAGE;
|
||||
const alertTypes = [alertType];
|
||||
const defaultClusterState = {
|
||||
clusterUuid: 'abc',
|
||||
|
@ -81,11 +81,11 @@ describe('fetchStatus', () => {
|
|||
expect(status).toEqual({
|
||||
monitoring_alert_cpu_usage: [
|
||||
{
|
||||
rawAlert: { id: 1 },
|
||||
sanitizedRule: { id: 1 },
|
||||
states: [],
|
||||
},
|
||||
{
|
||||
rawAlert: { id: 2 },
|
||||
sanitizedRule: { id: 2 },
|
||||
states: [],
|
||||
},
|
||||
],
|
||||
|
@ -149,11 +149,7 @@ describe('fetchStatus', () => {
|
|||
isEnabled: true,
|
||||
})),
|
||||
};
|
||||
await fetchStatus(
|
||||
rulesClient as any,
|
||||
[ALERT_CLUSTER_HEALTH],
|
||||
[defaultClusterState.clusterUuid]
|
||||
);
|
||||
await fetchStatus(rulesClient as any, [RULE_CLUSTER_HEALTH], [defaultClusterState.clusterUuid]);
|
||||
expect(customLicenseService.getWatcherFeature).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
@ -187,13 +183,13 @@ describe('fetchStatus', () => {
|
|||
};
|
||||
const status = await fetchStatus(
|
||||
customRulesClient as any,
|
||||
[ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_MONITORING_DATA],
|
||||
[RULE_CPU_USAGE, RULE_DISK_USAGE, RULE_MISSING_MONITORING_DATA],
|
||||
[defaultClusterState.clusterUuid]
|
||||
);
|
||||
expect(Object.keys(status)).toEqual([
|
||||
ALERT_CPU_USAGE,
|
||||
ALERT_DISK_USAGE,
|
||||
ALERT_MISSING_MONITORING_DATA,
|
||||
RULE_CPU_USAGE,
|
||||
RULE_DISK_USAGE,
|
||||
RULE_MISSING_MONITORING_DATA,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ import { AlertInstanceState } from '../../../common/types/alerts';
|
|||
import { RulesClient } from '../../../../alerting/server';
|
||||
import { AlertsFactory } from '../../alerts';
|
||||
import { CommonAlertState, CommonAlertFilter, RulesByType } from '../../../common/types/alerts';
|
||||
import { ALERTS } from '../../../common/constants';
|
||||
import { RULES } from '../../../common/constants';
|
||||
|
||||
export async function fetchStatus(
|
||||
rulesClient: RulesClient,
|
||||
|
@ -18,7 +18,7 @@ export async function fetchStatus(
|
|||
filters: CommonAlertFilter[] = []
|
||||
): Promise<RulesByType> {
|
||||
const rulesByType = await Promise.all(
|
||||
(alertTypes || ALERTS).map(async (type) => AlertsFactory.getByType(type, rulesClient))
|
||||
(alertTypes || RULES).map(async (type) => AlertsFactory.getByType(type, rulesClient))
|
||||
);
|
||||
if (!rulesByType.length) return {};
|
||||
|
||||
|
@ -26,13 +26,13 @@ export async function fetchStatus(
|
|||
const rulesWithStates = await Promise.all(
|
||||
rulesFlattened.map(async (rule) => {
|
||||
// we should have a different class to distinguish between "alerts" where the rule exists
|
||||
// and a BaseAlert created without an existing rule for better typing so we don't need to check here
|
||||
if (!rule.rawAlert) {
|
||||
throw new Error('alert missing rawAlert');
|
||||
// and a BaseRule created without an existing rule for better typing so we don't need to check here
|
||||
if (!rule.sanitizedRule) {
|
||||
throw new Error('alert missing sanitizedRule');
|
||||
}
|
||||
const id = rule.getId();
|
||||
if (!id) {
|
||||
throw new Error('alert missing id');
|
||||
throw new Error('rule missing id');
|
||||
}
|
||||
|
||||
// Now that we have the id, we can get the state
|
||||
|
@ -63,10 +63,10 @@ export async function fetchStatus(
|
|||
[]
|
||||
);
|
||||
|
||||
const type = rule.alertOptions.id;
|
||||
const type = rule.ruleOptions.id;
|
||||
const result = {
|
||||
states: alertStates,
|
||||
rawAlert: rule.rawAlert,
|
||||
sanitizedRule: rule.sanitizedRule,
|
||||
};
|
||||
return { type, result };
|
||||
})
|
||||
|
|
|
@ -24,9 +24,9 @@ import {
|
|||
import { get, has } from 'lodash';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
|
||||
import {
|
||||
ALERTS,
|
||||
KIBANA_MONITORING_LOGGING_TAG,
|
||||
KIBANA_STATS_TYPE_MONITORING,
|
||||
RULES,
|
||||
LOGGING_TAG,
|
||||
SAVED_OBJECT_TELEMETRY,
|
||||
} from '../common/constants';
|
||||
|
@ -125,7 +125,7 @@ export class MonitoringPlugin
|
|||
|
||||
const alerts = AlertsFactory.getAll();
|
||||
for (const alert of alerts) {
|
||||
plugins.alerting?.registerType(alert.getAlertType());
|
||||
plugins.alerting?.registerType(alert.getRuleType());
|
||||
}
|
||||
const config = createConfig(this.initializerContext.config.get<TypeOf<typeof configSchema>>());
|
||||
|
||||
|
@ -275,7 +275,7 @@ export class MonitoringPlugin
|
|||
app: ['monitoring', 'kibana'],
|
||||
catalogue: ['monitoring'],
|
||||
privileges: null,
|
||||
alerting: ALERTS,
|
||||
alerting: RULES,
|
||||
reserved: {
|
||||
description: i18n.translate('xpack.monitoring.feature.reserved.description', {
|
||||
defaultMessage: 'To grant users access, you should also assign the monitoring_user role.',
|
||||
|
@ -292,10 +292,10 @@ export class MonitoringPlugin
|
|||
},
|
||||
alerting: {
|
||||
rule: {
|
||||
all: ALERTS,
|
||||
all: RULES,
|
||||
},
|
||||
alert: {
|
||||
all: ALERTS,
|
||||
all: RULES,
|
||||
},
|
||||
},
|
||||
ui: [],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue