Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29548

AWS CloudWatch alarm is in "insufficient data" state when metrics are pushed using boto3

$
0
0

Alarm is on insufficient state for long time.

Graph of the metric:

enter image description here

This is the code that creates the alarm:

import boto3

# Create CloudWatch client
cloudwatch = boto3.client('cloudwatch')

# Create alarm
cloudwatch.put_metric_alarm(
    AlarmName='Web_Server_CPU_Utilization',
    ComparisonOperator='GreaterThanThreshold',
    EvaluationPeriods=1,
    MetricName='CPUUtilization',
    Namespace='AWS/EC2',
    Period=60,
    Statistic='Average',
    Threshold=70.0,
    ActionsEnabled=False,
    AlarmDescription='Alarm when server CPU exceeds 70%',
    Dimensions=[
        {
          'Name': 'InstanceId',
          'Value': 'INSTANCE_ID'
        },
    ],
    Unit='Seconds'
)

Also tried to create a metric alarm for Custom metrics, but this has different issue.

All the pre-defined metrics are in AWS namespaces and custom metrics are in Custom namespaces.

Tried giving Namespace='Custom/EC2', Namespace='EC2', Namespace='Custom/EC2',Namespace='AWS/EC2',Namespace='Custom/Custom'.

But any of those cases. It is not pushing to the respected metric.

enter image description here


Viewing all articles
Browse latest Browse all 29548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>