{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/7987","labels_url":"https://api.github.com/repos/ansible/ansible/issues/7987/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/7987/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/7987/events","html_url":"https://github.com/ansible/ansible/pull/7987","id":36795670,"number":7987,"title":"[wip] Rackspace Cloud Monitoring modules","user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/cloud","name":"cloud","color":"c7def8"},{"url":"https://api.github.com/repos/ansible/ansible/labels/feature_pull_request","name":"feature_pull_request","color":"009800"},{"url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"5319e7"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P3","name":"P3","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-06-30T13:10:19Z","updated_at":"2015-02-02T12:56:13Z","closed_at":"2014-09-29T19:58:29Z","pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/7987","html_url":"https://github.com/ansible/ansible/pull/7987","diff_url":"https://github.com/ansible/ansible/pull/7987.diff","patch_url":"https://github.com/ansible/ansible/pull/7987.patch"},"body":"This family of modules enables full management of a Rackspace Cloud Monitoring setup. Each module is idempotent, keying off of `label`: existing models will be updated with changed attributes if possible, or deleted and re-created otherwise.\r\n\r\nHere's what a full playbook that configures monitoring for a site looks like:\r\n\r\n```yaml\r\n---\r\n- name: Configure Cloud Monitoring\r\n  hosts: local\r\n  connection: local\r\n  gather_facts: false\r\n  vars:\r\n    monitoring_zones:\r\n    - mzdfw\r\n    - mziad\r\n    - mzord\r\n  tasks:\r\n\r\n  - name: Create a monitoring entity for the site to monitor.\r\n    rax_mon_entity:\r\n      credentials: ~/.rackspace_cloud_credentials\r\n      state: present\r\n      name: my_site\r\n      named_ip_addresses:\r\n        frontend: \"{{ frontend_ip }}\"\r\n    register: the_entity\r\n\r\n  - name: Fetch the frontpage.\r\n    rax_mon_check:\r\n      credentials: ~/.rackspace_cloud_credentials\r\n      state: present\r\n      entity_id: \"{{ the_entity['entity']['id'] }}\"\r\n      label: frontpage_check\r\n      check_type: remote.http\r\n      details:\r\n        url: http://{{ frontend_fqdn }}/\r\n        method: GET\r\n      monitoring_zones_poll: \"{{ monitoring_zones }}\"\r\n      target_alias: frontend\r\n    register: frontpage_check\r\n\r\n  - name: Email notification.\r\n    rax_mon_notification:\r\n      credentials: ~/.rackspace_cloud_credentials\r\n      state: present\r\n      label: who_ya_gonna_call\r\n      notification_type: email\r\n      details:\r\n        address: \"{{ opsfloor_email }}\"\r\n    register: email_notification\r\n\r\n  - name: Create a notification plan.\r\n    rax_mon_notification_plan:\r\n      credentials: ~/.rackspace_cloud_credentials\r\n      state: present\r\n      label: escalation_station\r\n      ok_state:\r\n      - \"{{ email_notification['notification']['id'] }}\"\r\n      warning_state:\r\n      - \"{{ email_notification['notification']['id'] }}\"\r\n      critical_state:\r\n      - \"{{ email_notification['notification']['id'] }}\"\r\n    register: escalation_station\r\n\r\n  - name: Trigger an alarm when the site errors out.\r\n    rax_mon_alarm:\r\n      credentials: ~/.rackspace_cloud_credentials\r\n      state: present\r\n      label: frontpage_alarm\r\n      entity_id: \"{{ the_entity['entity']['id'] }}\"\r\n      check_id: \"{{ frontpage_check['check']['id'] }}\"\r\n      notification_plan_id: \"{{ escalation_station['notification_plan']['id'] }}\"\r\n      criteria: >\r\n        if (metric['code'] != \"200\") {\r\n          return new AlarmStatus(CRITICAL, \"Non-200 status code #{code} returned.\");\r\n        }\r\n        if (metric['duration'] > 500) {\r\n          return new AlarmStatus(WARNING, \"Page render took #{duration}ms > 500ms.\");\r\n        }\r\n        return new AlarmStatus(OK);\r\n```\r\n\r\n/cc @sivel, @claco"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/72453735","html_url":"https://github.com/ansible/ansible/pull/7987#issuecomment-72453735","issue_url":"https://api.github.com/repos/ansible/ansible/issues/7987","id":72453735,"user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T12:56:13Z","updated_at":"2015-02-02T12:56:13Z","body":"> @smashwilson - do you have any plans to resubmit this as a core module?\r\n\r\n@git-harry: I'm not sure.\r\n\r\nI've since discovered the [Ansible galaxy role](https://galaxy.ansible.com/list#/roles/855) that installs the Rackspace monitoring agent, which subsumes all of this functionality without needing a bunch of extra modules, *as long as* each entity is a real host and not, for example, a load balancer.\r\n\r\nI'm not sure how much demand there would be for this particular edge case, then, and if it's worth submitting a network of five more fairly complex modules into core.\r\n\r\nHow difficult is it to manage *non*-core modules? I know that you can use `-m` to run modules in arbitrary directories, but is there something akin to galaxy for module distribution? I could easily see this becoming a \"Rackspace monitoring pack\" or something."}}