diff --git a/lib/infra/infra-stack.ts b/lib/infra/infra-stack.ts index b8860c86f3e..cd7b4c412a1 100644 --- a/lib/infra/infra-stack.ts +++ b/lib/infra/infra-stack.ts @@ -374,7 +374,7 @@ export class InfraStack extends Stack { value: nlb.loadBalancerDnsName, }); - if (props.enableMonitoring){ + if (props.enableMonitoring) { const monitoring = new InfraStackMonitoring(this, props.dashboardsUrl); } } diff --git a/lib/monitoring/alarms.ts b/lib/monitoring/alarms.ts index 149818662d8..337d1e7d4b3 100644 --- a/lib/monitoring/alarms.ts +++ b/lib/monitoring/alarms.ts @@ -18,6 +18,7 @@ export class InfraStackMonitoring { openSearchProcessNotFound: Metric | MathExpression, openSearchDashboardsProcessNotFound?: Metric | MathExpression, } + public readonly alarms: Alarm[] = [] constructor(infraStack: InfraStack, dashboardsUrl: string) { diff --git a/lib/os-cluster-entrypoint.ts b/lib/os-cluster-entrypoint.ts index a730b8c1197..89cd8e8b1a5 100644 --- a/lib/os-cluster-entrypoint.ts +++ b/lib/os-cluster-entrypoint.ts @@ -217,8 +217,8 @@ export class OsClusterEntrypoint { const remoteStore = `${scope.node.tryGetContext('enableRemoteStore')}`; const enableRemoteStore = remoteStore === 'true'; - const enableMonitoringAndAlarms = scope.node.tryGetContext('enableMonitoring'); - const enableMonitoring = enableMonitoringAndAlarms === 'true' + const monitoringAndAlarms = `${scope.node.tryGetContext('enableMonitoring')}`; + const enableMonitoring = monitoringAndAlarms === 'true'; const customRoleArn = `${scope.node.tryGetContext('customRoleArn')}`; diff --git a/test/os-cluster.test.ts b/test/os-cluster.test.ts index cfe489efb96..b986c2f0a4a 100644 --- a/test/os-cluster.test.ts +++ b/test/os-cluster.test.ts @@ -26,6 +26,7 @@ test('Test Resources with security disabled multi-node default instance types', additionalOsdConfig: '{ "something.enabled": "true", "something_else.enabled": "false" }', // eslint-disable-next-line max-len customConfigFiles: '{"test/data/config.yml": "opensearch/config/opensearch-security/config.yml", "test/data/roles.yml": "opensearch/config/opensearch-security/roles.yml"}', + enableMonitoring: true, }, });