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

Disable all datadog agent v6 services together #153

Merged
merged 2 commits into from
Mar 12, 2019

Conversation

pdecat
Copy link
Contributor

@pdecat pdecat commented Aug 29, 2018

This ensures that when datadog_enabled is set to no, the datadog-agent unit is disabled and not started by systemd as a dependency of the datadog-agent-process and datadog-agent-trace units.

Without this change, the datadog-agent unit, while disabled, is started on boot:

[pdecat@packer-5b866036-aaa8-542c-bca5-59e161e9413a]~ $ sudo systemctl status datadog-agent
● datadog-agent.service - "Datadog Agent"
   Loaded: loaded (/lib/systemd/system/datadog-agent.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-08-29 08:58:52 UTC; 2min 31s ago
 Main PID: 646 (agent)
    Tasks: 8 (limit: 4915)
   CGroup: /system.slice/datadog-agent.service
           └─646 /opt/datadog-agent/bin/agent/agent run -p /opt/datadog-agent/run/agent.pid

[pdecat@packer-5b866036-aaa8-542c-bca5-59e161e9413a]~ $ sudo systemctl is-enabled datadog-agent.service
disabled

[pdecat@packer-5b866036-aaa8-542c-bca5-59e161e9413a]~ $ sudo systemctl is-enabled datadog-agent-trace.service
enabled

[pdecat@packer-5b866036-aaa8-542c-bca5-59e161e9413a]~ $ sudo systemctl is-enabled datadog-agent-process.service
enabled

This is tested on debian stretch with ansible 2.6.3 and systemd 232.

@xp-1000
Copy link
Contributor

xp-1000 commented Oct 8, 2018

It seems to be a relevant change, any news about merging this ?

Gabelbombe added a commit to Gabelbombe/ansible-role-datadog that referenced this pull request Oct 15, 2018
@filiptepper
Copy link

@pdecat Do you think you could make services list configurable? ie. I don't need to run datadog-agent-trace on any of my instances.

@pdecat
Copy link
Contributor Author

pdecat commented Oct 16, 2018

Hi @filiptepper, making the services list configurable would be interesting too but out of the scope of this PR as far as I can tell.

Indeed, the current state without this PR is that the datadog-agent-trace.service and datadog-agent-process.service systemd units are enabled in all cases and actually prevent disabling the datadog-agent.service unit.
This PR is meant to fix just that and does not affect documentation.

Anyway, I glanced at doing what you asked and it seems way more far reaching than I thought.
For starters, the current way to disable the trace and process agents is documented in many places:

      apm_enabled: "true" # has to be set as a string

cf. https://github.com/DataDog/ansible-datadog#example-playbooks

DD_APM_ENABLED - overrides [Main] apm_enabled

cf. https://github.com/DataDog/datadog-trace-agent/blob/master/config/README.md#environment-variables

To control the behavior of the Process Agent, use the enabled variable under the datadog_config field. > It has to be set as a string and the possible values are: "true", "false" (for only container collection) or "disabled" (to disable the Process Agent entirely)

datadog_config:
  process_config:
    enabled: "true" # has to be set as a string

cf. https://github.com/DataDog/ansible-datadog#process-agent

# Enable the process agent.
process_agent_enabled = true

cf. https://github.com/DataDog/datadog-process-agent/tree/master/config#classic-configuration-values-and-how-the-trace-agent-treats-them

DD_PROCESS_AGENT_ENABLED - overrides [Main] process_agent_enabled

cf. https://github.com/DataDog/datadog-process-agent/tree/master/config#environment-variables

In my opinion, that should be addressed in another issue/PR.

@filiptepper
Copy link

@pdecat Thanks, that helped a lot!

@pdecat
Copy link
Contributor Author

pdecat commented Feb 6, 2019

Hi @hush-hush, could you please take a look at this one?

@pdecat pdecat force-pushed the disable-all-agent6-services branch from 984be82 to 71d2ee0 Compare March 6, 2019 09:03
@pdecat
Copy link
Contributor Author

pdecat commented Mar 6, 2019

Rebased following the renaming of tasks/agent6.yml to tasks/agent6-linux.yml.

Copy link
Member

@hush-hush hush-hush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pdecat,

Thanks you for this PR and sorry for the long time it took us to review it.

I added a comment let me know what you think,

@hush-hush hush-hush self-assigned this Mar 8, 2019
pdecat and others added 2 commits March 12, 2019 09:39
…atadog-agent is not started by systemd as a dependency of datadog-agent-process and datadog-agent-trace services
@pdecat pdecat force-pushed the disable-all-agent6-services branch from 71d2ee0 to 557529b Compare March 12, 2019 08:41
@hush-hush hush-hush merged commit 3210754 into DataDog:master Mar 12, 2019
@pdecat pdecat changed the title Enable/disable all datadog agent v6 services together Disable all datadog agent v6 services together Mar 12, 2019
@pdecat pdecat deleted the disable-all-agent6-services branch March 12, 2019 22:56
@pdecat
Copy link
Contributor Author

pdecat commented Mar 12, 2019

Thanks @hush-hush!

I've renamed the PR to reflect that this only changes the disabling of services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants