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

Datadog Agent Disable Fails on Windows Due to Win Process Dependency Order #328

Open
erikhjensen opened this issue Mar 15, 2021 · 6 comments

Comments

@erikhjensen
Copy link
Contributor

Conditions:
Server had Trace Agent and DD Agent.
Set datadog_enabled to false.

Issue:
List given to the stop task should be re ordered (in the reverse order for example) to stop trace and process before the DD agent otherwise the following error is received.

Error Message:
failed: [SERVERNAME.DOMAIN.EXT] (item=datadogagent) => {"ansible_loop_var": "item", "can_pause_and_continue": false, "changed": false, "depended_by": ["datadog-process-agent", "datadog-trace-agent"], "dependencies": [], "description": "Send metrics to Datadog", "desktop_interact": false, "display_name": "Datadog Agent", "exists": true, "item": "datadogagent", "msg": "Cannot stop service 'Datadog Agent (datadogagent)' because it has dependent services. It can only be stopped if the Force flag is set.", "name": "datadogagent", "path": ""C:\Program Files\Datadog\Datadog Agent\bin\agent.exe"", "start_mode": "auto", "state": "running", "username": ".\ddagentuser"}

@erikhjensen
Copy link
Contributor Author

Additionally, it seems that this task just sets the state of the agent to stopped. As such, it isn't so much "disable" as the opposite of "datadog_enabled" would suggest. The agent would start once again after a reboot.

@erikhjensen
Copy link
Contributor Author

I would like to push a branch for my testing and later consideration for PR. it seems this is not possible due to the current permissions model. What kind of workflow would you recommend? While I can push a copy of the source code to our own organization I see there are some contributors to issues within your org, lmk if this is open to your customers.

@KSerrania
Copy link
Contributor

Hey @erikhjensen,

Thanks for reporting this issue! Indeed, we should either change the order of services (to stop the datadogagent service last), or pass the Force flag to stop the services.

The workflow to propose changes is to create a fork of this repository (under your own name or the organization of your choice), make & test the changes there and then open a PR against our repository.

@erikhjensen
Copy link
Contributor Author

erikhjensen commented Mar 16, 2021 via email

@serhiichernukha
Copy link

serhiichernukha commented Oct 11, 2023

Facing the same issue. Is there any update on this one?
image

@serhiichernukha
Copy link

serhiichernukha commented Oct 11, 2023

The following worked for me: added sysprobe service to the loop because it's dependent on datadogagent service:

with_list:
    - datadog-trace-agent
    - datadog-process-agent
    - datadog-system-probe
    - datadogagent

image

image

To leverage this hack as a fix, it must be augmented with additional updates to the role. For example, datadog-system-probe service must be added to these kinds of tasks to manage it in the same way:
image

Alternatively, the same can be achieved by simply adding force_dependent_services: true

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

No branches or pull requests

3 participants