Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring dd #510

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d469354
Add playbook for deploying datadog agent to hosts
hellais Jan 30, 2024
3566bb8
Update Readme to mention new version of ansible
hellais Jan 30, 2024
7d5cd27
Remove travis vault creation in vault command
hellais Jan 30, 2024
e64ce48
Send data to EU site
hellais Jan 30, 2024
b19d741
Read the hostname from the inventory hostname
hellais Jan 30, 2024
0fec43c
Add agent to data.ooni.org
hellais Jan 30, 2024
c813ade
Fix typo in availability zone tag
hellais Jan 30, 2024
399b595
Add region tag
hellais Jan 30, 2024
adb4cbe
Add support for journald log collection
hellais Jan 30, 2024
7435e06
Fix yaml formatting
hellais Jan 30, 2024
78007d9
Add backend-hel to monitoring too
hellais Jan 30, 2024
39f0b0a
Refactor of the tags injection
hellais Jan 30, 2024
baa62b2
Add agent to monitoring host
hellais Jan 30, 2024
c501e4a
Add support for scraping prometheus metrics from monitoring host
hellais Jan 30, 2024
508e6b9
Remove duplicate grafana source list
hellais Jan 30, 2024
f469c94
Fix datadog openmetrics config
hellais Jan 30, 2024
11644c1
Add statsd metric collection
hellais Jan 30, 2024
6f3303f
Scrape netdata via the netadata openmetrics endpoint
hellais Jan 30, 2024
0afcc8a
Fix netdata URL
hellais Jan 30, 2024
20d65b9
Add federated metrics collection from prometheus
hellais Jan 31, 2024
d24f46f
Fix escaping
hellais Jan 31, 2024
ecbabd6
Split prometheus metrics into separate instances to faciliate scraping
hellais Jan 31, 2024
c390d41
Remove datadog agent
hellais Mar 5, 2024
1c31036
Remove datadog agent
hellais Mar 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ It is recommended you use a [python virtualenv](https://virtualenv.pypa.io/en/la
Once you activate the virtualenv you can install the correct version of ansible and dnspython with:

```
pip install ansible==2.9.16
# pip install ansible==2.9.16
pip install ansible==2.10.7
```


Expand Down
21 changes: 21 additions & 0 deletions ansible/deploy-datadog-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Runnning this role requires ansible >= 2.10 and running:
# ansible-galaxy install datadog.datadog
- hosts: have_datadog_agent
pre_tasks:
- name: set datadog tags
set_fact:
datadog_tags: >-
[
{% if dd_tag_cloud_provider is defined %}"cloud_provider:{{ dd_tag_cloud_provider }}",{% endif %}
{% if dd_tag_availability_zone is defined %}"availability-zone:{{ dd_tag_availability_zone }}",{% endif %}
{% if dd_tag_availability_zone is defined %}"region:{{ dd_tag_availability_zone }}",{% endif %}
{% if dd_tag_env is defined %}"env:{{ dd_tag_env }}",{% endif %}
{% if dd_tag_service is defined %}"service:{{ dd_tag_service }}",{% endif %}
"configuration_manager:ansible"
]
tasks:
- name: remove datadog agent
ansible.builtin.apt:
name: datadog-agent
state: absent
purge: yes
1 change: 1 addition & 0 deletions ansible/group_vars/have_datadog_agent/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ooni_datadog_api_key: "{{ vault_ooni_datadog_api_key }}"
8 changes: 8 additions & 0 deletions ansible/group_vars/have_datadog_agent/vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$ANSIBLE_VAULT;1.1;AES256
63316539646632353261333838373064663165633733333362363461336665323532386332383864
6262363162383032323764633466646435346566333564350a326636623161383663616563396435
35646338373037636538303937336338643032653636633362343139393539663566343833643063
6630633238366535370a373834633763616663653334636561653261643238303730613365366164
32386235303839346130393463373161633938343336383433646261616166326339313764623530
36356538636138656336316438333537663663323535666630333065303732373836373662333831
313937663936666436623235363838343561
17 changes: 17 additions & 0 deletions ansible/host_vars/backend-fsn.ooni.org/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,20 @@ base_url: "https://ams-pg.ooni.org/"
tor_targets: "{{ vault_tor_targets }}"
psiphon_config: "{{ vault_orchestra_psiphon_config_file_content }}"
digital_ocean_token: "{{ vault_digital_ocean_token }}"
ooni_datadog_checks:
journald:
logs:
- type: journald
container_mode: true
openmetrics:
instances:
- openmetrics_endpoint: "http://localhost:9090/metrics"
namespace: "ooniprom"
metrics:
- "^prom.+"
- "^net_.+"
- "^go_.+"
- metrics:
- ^netdata_statsd.*
namespace: ooninetdata
openmetrics_endpoint: http://localhost:19999/api/v1/allmetrics?format=prometheus&timestamps=no&types=yes&help=yes
45 changes: 45 additions & 0 deletions ansible/host_vars/monitoring.ooni.org/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,49 @@ blackbox_jobs:
module: icmp
targets: "{{ groups['dom0'] | list }}"

ooni_datadog_checks:
journald:
logs:
- type: journald
container_mode: true
openmetrics:
instances:
- openmetrics_endpoint: "http://localhost:9090/metrics"
namespace: "ooniprom"
metrics:
- "^prom.+"
- "^net_.+"
- "^go_.+"
- metrics:
- "^netdata_statsd.+"
excluded_metrics:
- ".+_datadog_.+"
namespace: ooninetdata
openmetrics_endpoint: "http://localhost:19999/api/v1/allmetrics?format=prometheus&timestamps=no&types=yes&help=yes"
prometheus:
instances:
- prometheus_url: 'http://localhost:9090/federate?match[]={job!=""}'
namespace: "oonipromfdrtd"
metrics:
- "oohelperd_*"
- "probe_*"
- "ooni_*"
- "go_*"
- "up*"
- "http_*"
- prometheus_url: 'http://localhost:9090/federate?match[]={job!=""}'
namespace: "oonipromstatsd"
metrics:
- "netdata_statsd_*"
metric_patterns:
include:
- "^oohelperd_.+"
- "^probe_.+"
- "^ooni_.+"
- "^go_.+"
- "^up.+"
- "^http_.+"
- "^netdata_statsd_.+"
exclude:
- ".+_datadog_.+"
...
30 changes: 30 additions & 0 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,35 @@ all:

have_tor: {}

have_datadog_agent:
hosts:
#backend-fsn.ooni.org:
# dd_tag_cloud_provider: hetzner
# dd_tag_availability_zone: eu-fsn
# dd_tag_env: prod
# dd_tag_service: oonibackend
monitoring.ooni.org:
dd_tag_cloud_provider: hetzner
dd_tag_availability_zone: eu-fsn
dd_tag_env: prod
dd_tag_service: monitoring
backend-hel.ooni.org:
dd_tag_cloud_provider: hetzner
dd_tag_availability_zone: eu-hel
dd_tag_env: test
dd_tag_service: oonibackend
data.ooni.org:
dd_tag_cloud_provider: hetzner
dd_tag_availability_zone: eu-fsn
dd_tag_env: test
dd_tag_service: oonidata
oonidata.ooni.org:
dd_tag_cloud_provider: hetzner
dd_tag_availability_zone: eu-fsn
dd_tag_env: prod
dd_tag_service: oonidata


monitoring:
hosts:
monitoring.ooni.org: {}
Expand All @@ -96,6 +125,7 @@ all:
backend-hel.ooni.org: {}
monitoring.ooni.org: {}
oonidata.ooni.org: {}
data.ooni.org: {}

probe_services:
hosts:
Expand Down
1 change: 0 additions & 1 deletion ansible/roles/monitoring/templates/grafana.list

This file was deleted.

5 changes: 5 additions & 0 deletions ansible/roles/oodd/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ooni_datadog_checks:
journald:
logs:
- type: journald
container_mode: true
11 changes: 11 additions & 0 deletions ansible/roles/oodd/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dependencies:
- role: datadog.datadog
become: yes
vars:
datadog_api_key: "{{ ooni_datadog_api_key }}"
datadog_site: "datadoghq.eu"
datadog_checks: "{{ ooni_datadog_checks }}"
datadog_config:
hostname: "{{ hostname }}"
logs_enabled: true
tags: "{{ tags }}"
1 change: 1 addition & 0 deletions ansible/roles/oodd/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- name: datadog.datadog
5 changes: 5 additions & 0 deletions ansible/roles/oodd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: Add dd-agent user to systemd-journal group
ansible.builtin.user:
name: dd-agent
groups: systemd-journal
append: yes
3 changes: 0 additions & 3 deletions ansible/vault
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/bash -ex
gitroot=$(git rev-parse --show-toplevel)
ansible-vault "$@" --vault-password-file "${gitroot}/ansible/password-pipe"
if [ "$1" != view ] && [ "$1" != decrypt ] && [ "$1" != rekey ]; then
"${gitroot}/scripts/mk-travis-vault"
fi