# ec2\_metric\_alarm is failling when passing dimensions argument

**URL:** <https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [June 25, 2014, 5:29pm UTC](https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546 "2014-06-25T17:29:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![douglaslopespereira](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@douglaslopespereira](https://forum.ansible.com/u/douglaslopespereira)\
**Post date:** [June 25, 2014, 5:29pm UTC](https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546/1 "2014-06-25T17:29:00Z")

</div>

I need to create an alarm associated with one of my AWS instances. For that I’m using the following task:

- name: Create CPU utilization metric alarm  
sudo: false  
local\_action: ec2\_metric\_alarm state=present region=us-east-1 name=“Alarm Name” metric=“CPUUtilization” statistic=Average comparison=“\>=” threshold=80.0 unit=“Percent” period=300 evaluation\_periods=1 description=“It will be triggered when CPU utilization is more than 80% for 5 minutes” dimensions={‘InstanceId’:‘i-abcdefg’}

And it is failling with this error:

_failed: [[ec2-54-237-178-129.compute-1.amazonaws.com](http://ec2-54-237-178-129.compute-1.amazonaws.com)] =\> {“failed”: true, “parsed”: false}_  
_invalid output was: Traceback (most recent call last):_  
_File “/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2\_metric\_alarm”, line 1670, in_   
_main()_  
_File “/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2\_metric\_alarm”, line 1655, in main_  
_module = AnsibleModule(argument\_spec=argument\_spec)_  
_File “/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2\_metric\_alarm”, line 337, in **init** _  
_self.\_check\_argument\_types()_  
_File “/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2\_metric\_alarm”, line 837, in \_check\_argument\_types_  
_(result, exc) = self.safe\_eval(value, dict(), include\_exceptions=True)_  
_AttributeError: ‘AnsibleModule’ object has no attribute ‘safe\_eval’_

_FATAL: all hosts have already failed – aborting_

Looks like it is trying to parse the dimensions argument as dict() but cannot do that.  
Any help is appreciated.

Regards,  
Douglas

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 26, 2014, 12:14am UTC](https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546/2 "2014-06-26T00:14:35Z")

</div>

This sounds like this may be a mixed version of Ansible to me, an old library or something half running out of devel and half an install.

---

<div class="post-metadata">

**Author:** ![douglaslopespereira](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@douglaslopespereira](https://forum.ansible.com/u/douglaslopespereira)\
**Post date:** [June 26, 2014, 10:33am UTC](https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546/3 "2014-06-26T10:33:07Z")

</div>

Is it possible to force upgrading all dependencies? All I did to get 1.6.5 was running:

$ sudo pip install boto --upgrade  
$ sudo pip install ansible --upgrade

Thanks for your time.  
Regards,  
Douglas

---

<div class="post-metadata">

**Author:** ![douglaslopespereira](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@douglaslopespereira](https://forum.ansible.com/u/douglaslopespereira)\
**Post date:** [June 26, 2014, 10:46am UTC](https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546/4 "2014-06-26T10:46:52Z")

</div>

I just read this blog post ([http://blog.willmer.org/2007/12/attributeerror-module-object-has-no-attribute-blah/](http://blog.willmer.org/2007/12/attributeerror-module-object-has-no-attribute-blah/)) and started thinking this might be a problem.  
Do we need the **init**.py file copied over to the directory where the ec2\_metric\_alarm script runs?

Hope to hear from you.  
Thanks.

---

<div class="post-metadata">

**Author:** ![douglaslopespereira](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@douglaslopespereira](https://forum.ansible.com/u/douglaslopespereira)\
**Post date:** [June 26, 2014, 10:53am UTC](https://forum.ansible.com/t/ec2-metric-alarm-is-failling-when-passing-dimensions-argument/15546/5 "2014-06-26T10:53:23Z")

</div>

Sorry for top posting over and over.  
A bug was already reported and should cover this error:

[https://github.com/ansible/ansible/issues/7679](https://github.com/ansible/ansible/issues/7679)

Any known workarround?

Thanks.  
Regards,  
Douglas
