{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/575","labels_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/575/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/575/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/575/events","html_url":"https://github.com/ansible/ansible-modules-extras/pull/575","id":84505189,"number":575,"title":"datadog_monitor module","user":{"login":"skornehl","id":7557177,"avatar_url":"https://avatars.githubusercontent.com/u/7557177?v=3","gravatar_id":"","url":"https://api.github.com/users/skornehl","html_url":"https://github.com/skornehl","followers_url":"https://api.github.com/users/skornehl/followers","following_url":"https://api.github.com/users/skornehl/following{/other_user}","gists_url":"https://api.github.com/users/skornehl/gists{/gist_id}","starred_url":"https://api.github.com/users/skornehl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skornehl/subscriptions","organizations_url":"https://api.github.com/users/skornehl/orgs","repos_url":"https://api.github.com/users/skornehl/repos","events_url":"https://api.github.com/users/skornehl/events{/privacy}","received_events_url":"https://api.github.com/users/skornehl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels/new_module","name":"new_module","color":"bfe5bf"},{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels/P3","name":"P3","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-03T11:24:38Z","updated_at":"2015-06-04T19:17:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/pulls/575","html_url":"https://github.com/ansible/ansible-modules-extras/pull/575","diff_url":"https://github.com/ansible/ansible-modules-extras/pull/575.diff","patch_url":"https://github.com/ansible/ansible-modules-extras/pull/575.patch"},"body":"I'm sorry for creating a concurrent PR to #539 but we needed this module and the existing one didn’t have all features we needed. I also decided to use the datadogpy instead of plain REST, I think this is more reliable than reimplementing the REST calls.\r\nShort description:\r\nThe options are all from the datadog API Page except state which can be set to 'present', 'absent', 'muted' and 'unmuted' \r\nI'm catching Exception which is not the best choice but datadog itself just raises http exceptions without any explanation. If I try to mute a monitor which is already muted it raises for example a 403. Due to that fact I also decided to fail if this happens (but with a real error message).\r\n\r\nSample playbook:\r\n\r\n```yaml\r\n---\r\n- hosts: localhost\r\n  gather_facts: false\r\n  tasks:\r\n    - name: Test Monitor\r\n      datadog_monitor:\r\n        type: \"metric alert\"\r\n        name: \"Test monitor\"\r\n        state: \"present\"\r\n        query: \"datadog.agent.up\".over(\"host:host1\").last(2).count_by_status()\"\r\n        message: \"Some message.\"\r\n        api_key: \"9775a026f1ca7d1c6c5af9d94d9595a4\"\r\n        app_key: \"87ce4a24b5553d2e482ea8a8500e71b8ad4554ff\"\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/comments/109017345","html_url":"https://github.com/ansible/ansible-modules-extras/pull/575#issuecomment-109017345","issue_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/575","id":109017345,"user":{"login":"apenney","id":9492,"avatar_url":"https://avatars.githubusercontent.com/u/9492?v=3","gravatar_id":"","url":"https://api.github.com/users/apenney","html_url":"https://github.com/apenney","followers_url":"https://api.github.com/users/apenney/followers","following_url":"https://api.github.com/users/apenney/following{/other_user}","gists_url":"https://api.github.com/users/apenney/gists{/gist_id}","starred_url":"https://api.github.com/users/apenney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apenney/subscriptions","organizations_url":"https://api.github.com/users/apenney/orgs","repos_url":"https://api.github.com/users/apenney/repos","events_url":"https://api.github.com/users/apenney/events{/privacy}","received_events_url":"https://api.github.com/users/apenney/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T19:17:59Z","updated_at":"2015-06-04T19:17:59Z","body":"Looks awesome, I'll close my PR in favor of this one!"}}