0
votes

I need to create script using boto3 which should make sending email notifications from AWS CloudWatch whenever instance in cluster is unhealthy.

I'm following put_metric_alarm() documentation to create boto3 script, and I found that to achieve my requirement I can use MRUnhealthyNodes metric type. I've written a small script to create alarm which should work:

client.put_metric_alarm (
AlarmName='name',
AlarmDescription='alarm description',
AlarmActions=[
    'sns:arn',
],
MetricName='MRUnhealthyNodes',
Namespace='AWS/ElasticMapReduce',
Statistic='Minimum',
Dimensions=[
    {
        'Name': 'string',
        'Value': 'string'
    },
],
Period=300,  
EvaluationPeriods=287,
Threshold=1,
ComparisonOperator='GreaterThanOrEqualToThreshold'

)

Here, I'm little confused what should be the value for:

Dimensions=[
    {
        'Name': 'string',
        'Value': 'string'
    },
]

I am new in the AWS world, so can someone help me with this? Thank you in advance!

1
Hi. I've noticed that you have a lot of questions with answers, but non-was accepted. If all the answers weren't useful, that's fine. But if the answers were helpful, their acceptance is not only a good practice, but it signals others in future with similar issues to solve their own issues. Also it reduces the amount of duplicate questions.Marcin

1 Answers

1
votes

The valid dimensions for EMR metrics are listed in Dimensions for Amazon EMR Metrics:

JobFlowId - The same as cluster ID, which is the unique identifier of a cluster in the form j-XXXXXXXXXXXXX. Find this value by clicking on the cluster in the Amazon EMR console.

JobId - The identifier of a job within a cluster. You can use this to filter the metrics returned from a cluster down to those that apply to a single job within the cluster. JobId takes the form job_XXXXXXXXXXXX_XXXX.