Skip to content

Commit 3986fa8

Browse files
authored
Add support for Universal Service Monitoring sysprobe configuration (#458)
Adds support for USM in the Ansible Datatog role.
1 parent 3bb392d commit 3986fa8

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ The system probe is configured under the `system_probe_config` variable. Any var
198198

199199
[Cloud Workload Security][8] is configured under the `runtime_security_config` variable. Any variables nested underneath are written to the `system-probe.yaml` and `security-agent.yaml`, in the `runtime_security_config` section.
200200

201+
[Universal Service Monitoring][17] (USM) is configured under the `service_monitoring_config` variable. Any variables nested underneath are written to the `system-probe.yaml`, in the `service_monitoring_config` section.
202+
201203
**Note for Windows users**: NPM is supported on Windows with Agent v6.27+ and v7.27+. It ships as an optional component that is only installed if `network_config.enabled` is set to true when the Agent is installed or upgraded. Because of this, existing installations might need to do an uninstall and reinstall of the Agent once to install the NPM component, unless the Agent is upgraded at the same time.
202204

203205
#### Example configuration
@@ -212,6 +214,8 @@ system_probe_config:
212214
sysprobe_socket: /opt/datadog-agent/run/sysprobe.sock
213215
network_config:
214216
enabled: true
217+
service_monitoring_config:
218+
enabled: true
215219
runtime_security_config:
216220
enabled: true
217221
```
@@ -635,3 +639,4 @@ To fix this, [update Ansible to `v2.9.8` or above][16].
635639
[14]: https://github.com/DataDog/ansible-datadog/blob/main/tasks/agent-win.yml
636640
[15]: https://www.datadoghq.com/blog/datadog-marketplace/
637641
[16]: https://github.com/ansible/ansible/blob/stable-2.9/changelogs/CHANGELOG-v2.9.rst#id61
642+
[17]: https://docs.datadoghq.com/tracing/universal_service_monitoring/?tab=configurationfiles#enabling-universal-service-monitoring

ci_test/install_agent_6.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
sysprobe_socket: /opt/datadog-agent/run/sysprobe.sock
2323
network_config:
2424
enabled: true
25+
service_monitoring_config:
26+
enabled: true
2527
datadog_checks:
2628
process:
2729
init_config:

ci_test/install_agent_7.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
sysprobe_socket: /opt/datadog-agent/run/sysprobe.sock
2323
network_config:
2424
enabled: true
25+
service_monitoring_config:
26+
enabled: true
2527
runtime_security_config:
2628
enabled: true
2729
datadog_checks:

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ datadog_config: {}
1313
# default system-probe.yaml options
1414
system_probe_config: {}
1515
network_config: {}
16+
service_monitoring_config: {}
1617

1718
# default checks enabled
1819
datadog_checks: {}

tasks/agent-linux.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
- name: Populate service facts
33
service_facts:
44

5+
- name: Set before 6/7.40.0 flag
6+
set_fact:
7+
datadog_before_7400: "{{ datadog_major is defined and datadog_minor is defined
8+
and datadog_major | int < 8 and datadog_minor | int < 40 }}"
9+
510
- name: Set before 6/7.24.1 flag
611
set_fact:
712
datadog_before_7241: "{{ datadog_major is defined and datadog_minor is defined and datadog_bugfix is defined
@@ -70,6 +75,24 @@
7075
when: not datadog_skip_running_check
7176
and (not datadog_before_7241)
7277

78+
# Since 6/7.40.0, setting enabled: true in service_monitoring_config is enough to start the system-probe service:
79+
# https://docs.datadoghq.com/tracing/universal_service_monitoring/?tab=configurationfiles#enabling-universal-service-monitoring
80+
- name: Set system probe enabled (since 6/7.40.0)
81+
set_fact:
82+
datadog_sysprobe_enabled: "{{
83+
((system_probe_config is defined
84+
and 'enabled' in (system_probe_config | default({}, true))
85+
and system_probe_config['enabled'])
86+
or (network_config is defined
87+
and 'enabled' in (network_config | default({}, true))
88+
and network_config['enabled'])
89+
or (service_monitoring_config is defined
90+
and 'enabled' in (service_monitoring_config | default({}, true))
91+
and service_monitoring_config['enabled']))
92+
and datadog_sysprobe_installed }}"
93+
when: not datadog_skip_running_check
94+
and (not datadog_before_7400)
95+
7396
- name: Ensure datadog-agent is running
7497
service:
7598
name: datadog-agent

templates/system-probe.yaml.j2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ network_config:
2222
{% endfilter %}
2323
{% endif %}
2424

25+
{% if service_monitoring_config is defined and service_monitoring_config | default({}, true) | length > 0 -%}
26+
service_monitoring_config:
27+
{# The "first" option in indent() is only supported by jinja 2.10+
28+
while the old equivalent option "indentfirst" is removed in jinja 3.
29+
Using non-keyword argument in indent() to be backward compatible.
30+
#}
31+
{% filter indent(2, True) %}
32+
{{ service_monitoring_config | to_nice_yaml }}
33+
{% endfilter %}
34+
{% endif %}
35+
2536
{% if runtime_security_config is defined and runtime_security_config | default({}, true) | length > 0 -%}
2637
runtime_security_config:
2738
{# The "first" option in indent() is only supported by jinja 2.10+

0 commit comments

Comments
 (0)