You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, EC2Monitoring does not support adding any alarms. and i was honestly a bit surprised at how I ultimately had to implement the alarms i wanted to implement.
I'd like to potentially take this on in a PR, but wanted to get some feedback here first (if possible)
At first, I tried to leverage the Ec2Monitoring class to get access to the metrics to use in monitorCustom. this did not work, in part because the metrics there are IMetric and not MetricWithAlarmSupport. The class does not support the StatusCheckFailed metric at all, and the other metrics are all exposed as the "wrong" type for what i need.
ultimately i got something working, but I am not sure that this is the best way:
using MonitoringFacade i create the metric factory:
I am using Ec2Monitoring, but I can't do much with it:
// create the monitoring widget for the summary dashboardthis.monitoring.monitorEC2Instances({
...monitorEc2Props,});
To then setup alarms, I use .monitorCustom():
this.monitoring.monitorCustom({metricGroups: [/** * MetricGroup for the inference instance */{title: 'Inference Instance Health',metrics: [/** * CPU Utilization Metric with Alarm * Will alarm when CPU breaches the threshold */{metric: this.getEC2InstanceMetric('CPUUtilization',MetricStatistic.AVERAGE,ec2DimensionsMap),alarmFriendlyName: 'inference-instance-cpu-utilization',addAlarm: {Critical: {threshold: 80,comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,actionsEnabled: true,datapointsToAlarm: 3,evaluationPeriods: 3,// missing data indicates that the instance is potentially down// treatMissingDataOverride: TreatMissingData.BREACHING,},},},/** * StatusCheckFailed Metric with Alarm * will alarm when either instance status check fails for 2 consecutive data points * when maximum statistic is >= to 1.0 */{metric: this.getEC2InstanceMetric('StatusCheckFailed',MetricStatistic.MAX,ec2DimensionsMap),alarmFriendlyName: 'inference-instance-status-check-failed',addAlarm: {Critical: {threshold: 1.0,comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,actionsEnabled: true,datapointsToAlarm: 2,evaluationPeriods: 2,},},},],},],addToAlarmDashboard: true,addToSummaryDashboard: false,alarmFriendlyName: 'inference-instance',});
I use a private method to create the metric using the metric factory:
// create a method to get the EC2 Metrics using the metric factoryprivategetEC2InstanceMetric(metricName: string,statistic: MetricStatistic,dimension: DimensionsMap){constmetric=this.metricFactory.createMetric(metricName,statistic,undefined,dimension,undefined,'AWS/EC2',);returnmetric;}
Any feedback appreciated
The text was updated successfully, but these errors were encountered:
Feature scope
EC2
Describe your suggested feature
Currently, EC2Monitoring does not support adding any alarms. and i was honestly a bit surprised at how I ultimately had to implement the alarms i wanted to implement.
I'd like to potentially take this on in a PR, but wanted to get some feedback here first (if possible)
At first, I tried to leverage the Ec2Monitoring class to get access to the metrics to use in monitorCustom. this did not work, in part because the metrics there are
IMetric
and notMetricWithAlarmSupport
. The class does not support the StatusCheckFailed metric at all, and the other metrics are all exposed as the "wrong" type for what i need.ultimately i got something working, but I am not sure that this is the best way:
using
MonitoringFacade
i create the metric factory:I am using Ec2Monitoring, but I can't do much with it:
To then setup alarms, I use
.monitorCustom()
:I use a private method to create the metric using the metric factory:
Any feedback appreciated
The text was updated successfully, but these errors were encountered: