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

Remove datadog checks #151

Merged
merged 8 commits into from
Jan 7, 2021
Merged

Conversation

Jno21
Copy link
Contributor

@Jno21 Jno21 commented Aug 22, 2018

This PR is a proposal for the issue 43.

By setting: datadog_disable_untracked_checks to true all the files that are not in datadog_checks and datadog_additional_checks will be removed.

datadog_additional_checks allow you to add some checks that won't be remove while running the ansible role with datadog_disable_untracked_checks: true.

If you have any feedback it will be appreciated, I am still new to Ansible :)

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

thanks @Jno21, much needed, especially in the beginning of integration when the velocity of changes to these checks are high from testing/optimizing/rearrangingu integrations. Been burned a couple of times not realizing old checks were still running

@dabcoder
Copy link

dabcoder commented May 24, 2019

@Jno21 Sorry about the long delay here. I'm currently testing this and it looks pretty good so far. Your branch is now out of sync with master, would you mind rebasing it on master then (we've split the agent 6 yaml file in 2 - Linux and Windows, and removed support for agent 5 on Windows)

@Jno21 Jno21 force-pushed the remove-datadog-checks branch from 3cb7e5b to f6a9ad6 Compare June 27, 2019 21:02
@Jno21
Copy link
Contributor Author

Jno21 commented Jun 27, 2019

Hi, Sorry about the delay also. I rebased to be in sync with master, I also did it for Windows (I couldn't test it tho, so I am not 100% sure about it).
If the windows one is not correct I can drop the commit and we can still merge.

Copy link

@dabcoder dabcoder left a comment

Choose a reason for hiding this comment

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

Left a couple of notes, thanks for getting back to us!

tasks/agent5-linux.yml Outdated Show resolved Hide resolved
tasks/agent5-linux.yml Outdated Show resolved Hide resolved
@izeau
Copy link

izeau commented Oct 22, 2019

Is there any advancement on this? I'd love to be able to use this role without relying on @Jno21's fork! Thanks.

Copy link
Contributor

@KSerrania KSerrania left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I left some questions and suggestions.

There's a merge conflict because the README got updated on master (the list of attributes has become a table), could you update your PR to resolve the conflict?

find:
paths: /etc/dd-agent/conf.d/
pattern: "*.yaml"
file_type: directory
Copy link
Contributor

Choose a reason for hiding this comment

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

On Agent 5, this directly matches files (as there are no <check>.d folders), so the file type should be changed accordingly (otherwise Ansible doesn't match anything since there are no directories ending in .yaml)

Suggested change
file_type: directory
file_type: file


- name: Delete checks not present in datadog_tracked_checks
file:
path: "/etc/dd-agent/conf.d/{{ item }}.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

This will remove any user-defined configuration of the checks, but in the case of core checks (disk, memory, etc.), they will still be running with the default configuration, as the default config file ({{ item }}.yaml.default) will still be present.
Is this expected? Or should the default files also be removed?

(Same question for Agent 6, with the conf.d/{{ item }}.d/conf.yaml.default files)

Choose a reason for hiding this comment

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

While it would be useful to keep them as a base case, I think it'll make things a lot complexer when people start modifying the defaults - and there are likely use cases where you want to remove the defaults anyway.

Maybe an additional config option (datadog_disable_default_checks)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey ! I followed @lesteenman idea by adding a datadog_disable_default_checks option (true or false). So it will remove all defaults checks or not.
If you want to go further with the idea you can pick it up to choose which one you will prefer to remove (list).

README.md Outdated
@@ -29,6 +29,8 @@ Role Variables
- `datadog_checks` - YAML configuration for agent checks to drop into:
+ `/etc/datadog-agent/conf.d/<check_name>.d/conf.yaml` for agent6
+ `/etc/dd-agent/conf.d` for agent5.
- `datadog_disable_untracked_checks` - Set to `true` to remove all checks not present in `datadog_checks` and `datadog_additional_checks`.
- `datadog_additional_checks`: List of additional checks that won't be remove if `datadog_disable_untracked_checks` is set to `true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `datadog_additional_checks`: List of additional checks that won't be remove if `datadog_disable_untracked_checks` is set to `true`.
- `datadog_additional_checks`: List of additional checks that won't be removed if `datadog_disable_untracked_checks` is set to `true`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@lesteenman
Copy link

@Jno21, do you plan to finish this PR? I might be able to pick it up otherwise.

@Jno21 Jno21 requested review from a team as code owners September 17, 2020 14:45
@Jno21 Jno21 force-pushed the remove-datadog-checks branch from 2edb3da to 217ed89 Compare September 17, 2020 14:54
@Jno21
Copy link
Contributor Author

Jno21 commented Sep 17, 2020

Hey ! Sorry for the long wait, I made corrections like asked and added the idea of @lesteenman !
I didn't have time to test it (I am in vacation). So if somebody could make sure it is correct and working and after we are good to go :)
It will be cool to merge this PR :D

Copy link

@kayayarai kayayarai left a comment

Choose a reason for hiding this comment

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

small grammar fix, otherwise good from a documentation perspective.

README.md Outdated Show resolved Hide resolved
Co-authored-by: Kari Halsted <[email protected]>
@albertvaka
Copy link
Contributor

Thanks for your PR and sorry for the (very long) wait 🙇 LGTM and merging! 👍

@albertvaka albertvaka merged commit c62cd6a into DataDog:master Jan 7, 2021
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.

8 participants