Reputation: 31
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!
Upvotes: 0
Views: 670
Reputation: 238289
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.
Upvotes: 1