From 1ffb2a1c03fbb3b469ff7faa198dc504b331dd6b Mon Sep 17 00:00:00 2001 From: Greg Szabo Date: Mon, 20 Aug 2018 11:46:27 -0400 Subject: [PATCH] DataDog update script --- networks/remote/ansible/install-datadog-agent.yml | 1 + .../roles/install-datadog-agent/tasks/main.yml | 8 -------- .../files/conf.d/http_check.d/conf.yaml | 13 +++++++++++++ .../files/conf.d/network.d/conf.yaml | 0 .../files/conf.d/process.d/conf.yaml | 0 .../files/conf.d/prometheus.d/conf.yaml | 7 +++++-- .../roles/update-datadog-agent/handlers/main.yml | 5 +++++ .../roles/update-datadog-agent/tasks/main.yml | 10 ++++++++++ .../templates/datadog.yaml.j2 | 0 networks/remote/ansible/update-datadog-agent.yml | 10 ++++++++++ 10 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 networks/remote/ansible/roles/update-datadog-agent/files/conf.d/http_check.d/conf.yaml rename networks/remote/ansible/roles/{install-datadog-agent => update-datadog-agent}/files/conf.d/network.d/conf.yaml (100%) rename networks/remote/ansible/roles/{install-datadog-agent => update-datadog-agent}/files/conf.d/process.d/conf.yaml (100%) rename networks/remote/ansible/roles/{install-datadog-agent => update-datadog-agent}/files/conf.d/prometheus.d/conf.yaml (51%) create mode 100644 networks/remote/ansible/roles/update-datadog-agent/handlers/main.yml create mode 100644 networks/remote/ansible/roles/update-datadog-agent/tasks/main.yml rename networks/remote/ansible/roles/{install-datadog-agent => update-datadog-agent}/templates/datadog.yaml.j2 (100%) create mode 100644 networks/remote/ansible/update-datadog-agent.yml diff --git a/networks/remote/ansible/install-datadog-agent.yml b/networks/remote/ansible/install-datadog-agent.yml index d32458703399..54b77e1f8241 100644 --- a/networks/remote/ansible/install-datadog-agent.yml +++ b/networks/remote/ansible/install-datadog-agent.yml @@ -7,4 +7,5 @@ gather_facts: no roles: - install-datadog-agent + - update-datadog-agent diff --git a/networks/remote/ansible/roles/install-datadog-agent/tasks/main.yml b/networks/remote/ansible/roles/install-datadog-agent/tasks/main.yml index bba86a5ac3ba..0c0a49ecac34 100644 --- a/networks/remote/ansible/roles/install-datadog-agent/tasks/main.yml +++ b/networks/remote/ansible/roles/install-datadog-agent/tasks/main.yml @@ -13,14 +13,6 @@ DD_API_KEY: "{{DD_API_KEY}}" DD_HOST_TAGS: "testnet:{{TESTNET_NAME}},cluster:{{CLUSTER_NAME}}" -- name: Set datadog.yaml config - template: src=datadog.yaml.j2 dest=/etc/datadog-agent/datadog.yaml - notify: restart datadog-agent - -- name: Set metrics config - copy: src=conf.d/ dest=/etc/datadog-agent/conf.d/ - notify: restart datadog-agent - - name: Disable journald rate-limiting lineinfile: "dest=/etc/systemd/journald.conf regexp={{item.regexp}} line='{{item.line}}'" with_items: diff --git a/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/http_check.d/conf.yaml b/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/http_check.d/conf.yaml new file mode 100644 index 000000000000..6932ed6f4065 --- /dev/null +++ b/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/http_check.d/conf.yaml @@ -0,0 +1,13 @@ +init_config: + +instances: + - name: gaiad + url: http://localhost:26657/status + timeout: 1 + content_match: '"latest_block_height": "0",' + reverse_content_match: true + + - name: gaiacli + url: http://localhost:1317/node_version + timeout: 1 + diff --git a/networks/remote/ansible/roles/install-datadog-agent/files/conf.d/network.d/conf.yaml b/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/network.d/conf.yaml similarity index 100% rename from networks/remote/ansible/roles/install-datadog-agent/files/conf.d/network.d/conf.yaml rename to networks/remote/ansible/roles/update-datadog-agent/files/conf.d/network.d/conf.yaml diff --git a/networks/remote/ansible/roles/install-datadog-agent/files/conf.d/process.d/conf.yaml b/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/process.d/conf.yaml similarity index 100% rename from networks/remote/ansible/roles/install-datadog-agent/files/conf.d/process.d/conf.yaml rename to networks/remote/ansible/roles/update-datadog-agent/files/conf.d/process.d/conf.yaml diff --git a/networks/remote/ansible/roles/install-datadog-agent/files/conf.d/prometheus.d/conf.yaml b/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/prometheus.d/conf.yaml similarity index 51% rename from networks/remote/ansible/roles/install-datadog-agent/files/conf.d/prometheus.d/conf.yaml rename to networks/remote/ansible/roles/update-datadog-agent/files/conf.d/prometheus.d/conf.yaml index b08908400cbe..20c04ceee3c4 100644 --- a/networks/remote/ansible/roles/install-datadog-agent/files/conf.d/prometheus.d/conf.yaml +++ b/networks/remote/ansible/roles/update-datadog-agent/files/conf.d/prometheus.d/conf.yaml @@ -2,6 +2,9 @@ init_config: instances: - prometheus_url: http://127.0.0.1:26660 - namespace: "gaiad" metrics: - - p2p: * + - go* + - mempool* + - p2p* + - process* + - promhttp* diff --git a/networks/remote/ansible/roles/update-datadog-agent/handlers/main.yml b/networks/remote/ansible/roles/update-datadog-agent/handlers/main.yml new file mode 100644 index 000000000000..90e05c17ddfd --- /dev/null +++ b/networks/remote/ansible/roles/update-datadog-agent/handlers/main.yml @@ -0,0 +1,5 @@ +--- + +- name: restart datadog-agent + service: name=datadog-agent state=restarted + diff --git a/networks/remote/ansible/roles/update-datadog-agent/tasks/main.yml b/networks/remote/ansible/roles/update-datadog-agent/tasks/main.yml new file mode 100644 index 000000000000..c6174c6af2cc --- /dev/null +++ b/networks/remote/ansible/roles/update-datadog-agent/tasks/main.yml @@ -0,0 +1,10 @@ +--- + +- name: Set datadog.yaml config + template: src=datadog.yaml.j2 dest=/etc/datadog-agent/datadog.yaml + notify: restart datadog-agent + +- name: Set metrics config + copy: src=conf.d/ dest=/etc/datadog-agent/conf.d/ + notify: restart datadog-agent + diff --git a/networks/remote/ansible/roles/install-datadog-agent/templates/datadog.yaml.j2 b/networks/remote/ansible/roles/update-datadog-agent/templates/datadog.yaml.j2 similarity index 100% rename from networks/remote/ansible/roles/install-datadog-agent/templates/datadog.yaml.j2 rename to networks/remote/ansible/roles/update-datadog-agent/templates/datadog.yaml.j2 diff --git a/networks/remote/ansible/update-datadog-agent.yml b/networks/remote/ansible/update-datadog-agent.yml new file mode 100644 index 000000000000..3fe1e0006ef0 --- /dev/null +++ b/networks/remote/ansible/update-datadog-agent.yml @@ -0,0 +1,10 @@ +--- + +#DD_API_KEY,TESTNET_NAME,CLUSTER_NAME required + +- hosts: all + any_errors_fatal: true + gather_facts: no + roles: + - update-datadog-agent +