ec2_metric_alarm does not create custom System/Linux alerts

Hello

I am using ec2_metric_alarm and it does not seem to create custom System/Linux alerts.

Alarms for for the AWS/EC2 cloudWatch metrics provided by default by AWS get created properly. As an example the following works. One can see the alert created in AWS console.

`

  • name: create cpu-high alarm
    ec2_metric_alarm:
    aws_access_key: “{{ ec2_access_key }}”
    aws_secret_key: “{{ ec2_secret_key }}”
    state: present
    region: “{{ ec2_region }}”
    name: “cpu-high”
    metric: “CPUUtilization”
    namespace: “AWS/EC2”
    statistic: Average
    comparison: “>”
    threshold: 75.0
    period: 300
    evaluation_periods: 3
    unit: “Percent”
    description: “This will alarm when cpu usage average is greater than 75% for 15 minutes "
    dimensions: '{“InstanceId”:”{{ ansible_ec2_instance_id }}“}’
    alarm_actions: [”{{ alarm_sns }}"]
    tags:
  • cloudwatch
    `

Here is the ansible log when the alarm is being created:

changed: [ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com] => {"actions_enabled": "true", "alarm_actions": ["arn:aws:sns:XXXX:XXXX"], "alarm_arn": "arn:aws:cloudwatch:us-east-1:XXXXX:alarm:cpu-high", "changed": true, "comparison": "GreaterThanThreshold", "description": "This will alarm when a$ aerospike cpu usage average is greater than 75% for 15 minutes ", "dimensions": {"InstanceId": ["i-XXXXX"]}, "evaluation_periods": 3, "insufficient_data_actions": [], "last_updated": "2015-07-21T20:58:56.310Z", "metric": "CPUUtilization", "name": "cpu-high", "namespace": "AWS/EC2", "ok_actions": [], "period": 300, "stat$ _reason": "Insufficient Data: 3 datapoints were unknown.", "state_value": "INSUFFICIENT_DATA", "statistic": "Average", "threshold": 75.0, "unit": "Percent"}

However the following does not create an alert. I do not see the alerts being created in the AWS console

`

  • name: create disk xvda1 utilization alarm
    ec2_metric_alarm:
    aws_access_key: “{{ ec2_access_key }}”
    aws_secret_key: “{{ ec2_secret_key }}”
    state: present
    region: “{{ ec2_region }}”
    name: “disk-high”
    metric: “DiskSpaceUtilization”
    namespace: “System/Linux”
    statistic: Average
    comparison: “>”
    threshold: 50.0
    period: 300
    evaluation_periods: 3
    unit: “Percent”
    description: “This will alarm when disk utilization is greater than 50% for 15 minutes "
    dimensions: '{“InstanceId”:”{{ ansible_ec2_instance_id }}“, “Filesystem”: “/dev/xvda1”}’
    alarm_actions: [”{{ alarm_sns }}"]
    tags:
  • cloudwatch
    `

Here is the ansible log when the alarm is being created:

changed: [ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com] => {"actions_enabled": "true", "alarm_actions": ["arn:aws:sns:us-east-1:XXXX:XXXX"], "alarm_arn": "arn:aws:cloudwatch:us-east-1:XXXXX:alarm:disk-high", "changed": true, "comparison": "GreaterThanThreshold", "description": "This will alarm when disk utilization is greater than 50% for 15 minutes ", "dimensions": {"Filesystem": ["/dev/xvda1"], "InstanceId": ["i-XXXXX"]}, "evaluation_periods": 3, "insufficient_data_actions": [], "last_updated": "2015-07-21T20:59:04.034Z", "metric": "DiskSpaceUtilization", "name": "disk-high", "namespace": "System/Linux ", "ok_actions": [], "period": 300, "state_reason": "Unchecked: Initial alarm creation", "state_value": "INSUFFICIENT_DATA", "statistic": "Average", "threshold": 50.0, "unit": "Percent"}

Please note that we want to create alerts based on the custom scripts that Amazon provided: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts-perl.html

Please note that the cron job that publishes the data point ran before we attempted to create the alerts. So the metrics are visible and available in the Amazon Console when the ansible ec2_metric_alarm runs.

Jul 22 15:15:01 ip-XXX-XXX-XXX-XXX CROND[13092]: (ec2-user) CMD (/home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --mem-avail --swap-util --swap-used --disk-path=/ --disk-path=/tmp --disk-path=/opt --disk-path=/var/log --disk-space-util --disk-space-used --disk-space-avail --aws-credential-file=/home/ec2-user/aws-scripts-mon/awscreds.conf --from-cron)

We are using ansible-playbook 1.9.0.1

I would appreciate any guidance. Thank you for your help!