简体   繁体   中英

AWS cloudwatch alarm can't access data from EMR cluster metrices when formed by cloudformation template

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Metadata": {
        "AWS::CloudFormation::Designer": {
            "0146279a-ddf6-40fa-bf45-612cebe20c3f": {
                "size": {
                    "width": 60,
                    "height": 60
                },
                "position": {
                    "x": 290,
                    "y": 80
                },
                "z": 0,
                "embeds": []
            },
            "f53318cc-f7a9-4e0b-9d22-7de325b7409d": {
                "size": {
                    "width": 60,
                    "height": 60
                },
                "position": {
                    "x": 430,
                    "y": 80
                },
                "z": 0
            }
        }
    },
    "Resources": {
        "EMRC1YFGX": {
            "Type": "AWS::EMR::Cluster",
            "Properties": {
                "ReleaseLabel": "emr-5.30.0",
                "Instances": {
                    "MasterInstanceGroup": {
                        "InstanceCount": 1,
                        "InstanceType": "m5.xlarge"
                    },
                    "CoreInstanceGroup": {
                        "InstanceCount": 1,
                        "InstanceType": "m5.xlarge"
                    }
                },
                "Name": "Tupac",
                "JobFlowRole": "arn:aws:iam::261537044157:instance-profile/EMR_EC2_DefaultRole",
                "ServiceRole": "arn:aws:iam::261537044157:role/shubhamam"
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "0146279a-ddf6-40fa-bf45-612cebe20c3f"
                }
            }
        },
        "CWA2VB7L": {
            "Type": "AWS::CloudWatch::Alarm",
            "Properties": {
                "AlarmName": "alarm101",
                "AlarmActions": ["arn:aws:sns:us-east-1:2615370449570:emr_idle_notification"],
                "ComparisonOperator": "GreaterThanOrEqualToThreshold",
                "Dimensions": [
                    {
                        "Name": "JobflowId",
                        "Value": {"Ref": "EMRC1YFGX"}
                    }
                ],
                "EvaluationPeriods": 1,
                "MetricName": "IsIdle",
                "Namespace": "AWS/ElasticMapReduce",
                "Period": 300,
                "Statistic": "Minimum",
                "Threshold": 1,
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "f53318cc-f7a9-4e0b-9d22-7de325b7409d"
                }
            }
        }
    }
}

I am using the above cloudformation template for creating my EMR cluster and for Cloudwatch alarm. if i create a normal alarm from console than it works correctly but while creating while cloudformation it don't works. The alarm is created but it can't get any of the data from EMR metrices. It says no data and it remains in Insufficient data state.

The apparent issue is the use of JobflowId instead of JobFlowId .

This is because dimension names are case-sensitive .

I could not find documentation about case-sensitivity of dimension names in CloudWatch, thus I tested this myself by creating two alarms.

One alarm was based on correctly spelled dimension name AmazonEC2 (Billing metric). Second alarm was based on in-correctly spelled spelled name: AmazonEc2 . Everything else was same between the two alarms.

I found that the alarm with the incorrect name got stack in INSUFFICIENT sate. This is the same state which OP reports.

A screenshot of the alarms (cost blacked out):

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM