Create Windows Memory Usage Alarms – lambda python

severity = "Warning"
        alarm_title = "Windows_memory_usage"
        response = cw.put_metric_alarm(
         AlarmName = "%s_%s_%s_(Lambda)" % (severity, nameinstance, alarm_title),
         AlarmDescription='Windows Memory Usage',
         ActionsEnabled=True,
         AlarmActions=[ec2_sns,],
         MetricName='Memory % Committed Bytes In Use',
         Namespace='CWAgent',
         Statistic='Average',
         Dimensions=[ {'Name': "InstanceId",    'Value': instanceid},
                      {'Name': 'ImageId',       'Value': instance.image_id},
                      {'Name': 'objectname',    'Value': 'Memory'},
                      {'Name': 'InstanceType',  'Value': instance.instance_type}
                    ],
         Period=60,
         EvaluationPeriods=3,
         Threshold=80.0,
         ComparisonOperator='GreaterThanOrEqualToThreshold'
        ) 
        if logging_verbosity > 9:
            print (response)
Tags: No tags
0

Add a Comment

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