From 0057dab68f2ee32e0a0254726633a507e0c0cfa9 Mon Sep 17 00:00:00 2001 From: mkangia Date: Thu, 19 Dec 2024 23:45:13 +0530 Subject: [PATCH] add rabbitmq monitoring --- roles/commcare_analytics/tasks/datadog.yml | 9 +++++++++ roles/commcare_analytics/tasks/rabbitmq.yml | 9 +++++++++ .../templates/datadog/rabbitmq.yaml.j2 | 12 ++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 roles/commcare_analytics/templates/datadog/rabbitmq.yaml.j2 diff --git a/roles/commcare_analytics/tasks/datadog.yml b/roles/commcare_analytics/tasks/datadog.yml index 2a7e6bf..44fd24a 100644 --- a/roles/commcare_analytics/tasks/datadog.yml +++ b/roles/commcare_analytics/tasks/datadog.yml @@ -27,6 +27,15 @@ mode: 0640 tags: datadog +- name: Add rabbitmq config + template: + src: "datadog/rabbitmq.yaml.j2" + dest: "/etc/datadog-agent/conf.d/rabbitmq.d/conf.yaml" + owner: dd-agent + group: dd-agent + mode: 0640 + tags: datadog + - name: Restart Datadog service ansible.builtin.service: name: datadog-agent diff --git a/roles/commcare_analytics/tasks/rabbitmq.yml b/roles/commcare_analytics/tasks/rabbitmq.yml index fe5b785..e050ee5 100644 --- a/roles/commcare_analytics/tasks/rabbitmq.yml +++ b/roles/commcare_analytics/tasks/rabbitmq.yml @@ -26,6 +26,15 @@ ignore_errors: '{{ ansible_check_mode }}' tags: rabbitmq +- name: Enable rabbitmq plugins + rabbitmq_plugin: + names: rabbitmq_management + state: enabled + ignore_errors: '{{ ansible_check_mode }}' + notify: + - restart rabbitmq + tags: rabbitmq + - name: Place config file template: src: "{{ item.src }}" diff --git a/roles/commcare_analytics/templates/datadog/rabbitmq.yaml.j2 b/roles/commcare_analytics/templates/datadog/rabbitmq.yaml.j2 new file mode 100644 index 0000000..5446127 --- /dev/null +++ b/roles/commcare_analytics/templates/datadog/rabbitmq.yaml.j2 @@ -0,0 +1,12 @@ +# +# {{ ansible_managed }} +# +init_config: + +instances: + - rabbitmq_api_url: http://localhost:15672/api/ + rabbitmq_user: {{ rabbitmq_user }} + rabbitmq_pass: {{ rabbitmq_password }} + tags: + - instance:{{ datadog.hostname }} + skip_proxy: true