Create Linux Memory Usage Alarms – using lambda python

severity = "Warning"
            alarm_title = "Linux_memory_usage"
            response = cw.put_metric_alarm(
             AlarmName = "%s_%s_%s_(Lambda)" % (severity, nameinstance, alarm_title),
             AlarmDescription='Linux Memory Usage',
             ActionsEnabled=True,
             AlarmActions=[ec2_sns,],
             MetricName='mem_used_percent',
             Namespace='CWAgent',
             Statistic='Average',
             Dimensions=[ {'Name': "InstanceId",   'Value': instanceid},
                          {'Name': 'ImageId',      'Value': instance.image_id},
                          {'Name': 'InstanceType', 'Value': instance.instance_type}
                        ],
             Period=300,
             EvaluationPeriods=1,
             Threshold=80.0,
             ComparisonOperator='GreaterThanOrEqualToThreshold'
            )
            if logging_verbosity > 9:
                print (response)
            print ("EVALUATED")
     elif   (instance.platform == 'windows'):
        #ImageId, InstanceId, InstanceType
Tags: No tags
0

Add a Comment

Your email address will not be published. Required fields are marked *