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

Add configcheck command #1139

Merged
merged 8 commits into from
Feb 5, 2018
Merged

Add configcheck command #1139

merged 8 commits into from
Feb 5, 2018

Conversation

mfpierre
Copy link
Contributor

What does this PR do?

Add a configcheck command that helps investigating the current loaded/resolved configs for each config provider:

screen shot 2018-01-29 at 18 49 05

Additionnally with a -v option it can output debug info such as the warnings during resolve and the templates yet to be resolved:

screen shot 2018-01-30 at 11 02 11

The output of this commande (in debug mode) is added to the flare to a config-check.log file

Motivation

The autodiscovery is a piece of the agent where a lot of components could go wrong (template, ad identifiers, discovery...) and that's why we need a tool to give an idea of the current state of a running agent for development & debugging purposes

@mfpierre mfpierre requested review from masci and a team January 30, 2018 10:22
@mfpierre mfpierre requested a review from a team as a code owner January 30, 2018 10:22
@mfpierre mfpierre added this to the 6.0.0-beta.10 milestone Jan 30, 2018
@mfpierre mfpierre force-pushed the mfpierre/config-check branch from c057f81 to 0173350 Compare January 31, 2018 10:11
Copy link
Member

@hkaj hkaj left a comment

Choose a reason for hiding this comment

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

Great stuff 💯 LGTM overall, just one issue: I tried adding a check config file with invalid yaml and it didn't show in the configcheck command output. We can see it in the logs of course, but it would be nice if configcheck could outline the unmarshalling error. Here's the log output:

2018-02-04 12:42:22 UTC | INFO | (file.go:68 in Collect) | File Configuration Provider: searching for configuration files at: /etc/datadog-agent/conf.d
2018-02-04 12:42:22 UTC | WARN | (file.go:180 in collectEntry) | /etc/datadog-agent/conf.d/nginx.d/conf.yaml is not a valid config file: yaml: unmarshal errors:
  line 4: cannot unmarshal !!str `:foo:ba...` into []check.ConfigRawMap

@tmcarr
Copy link

tmcarr commented Feb 4, 2018

@hkaj I believe this is related to the bug report I submitted recently. The same issue occurs in the most recent releases too, in the check command.

@tmcarr
Copy link

tmcarr commented Feb 5, 2018

#1159

Copy link
Member

@hkaj hkaj left a comment

Choose a reason for hiding this comment

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

we need it now, let's merge as is and handle yaml errors in a follow-up PR.

@mfpierre mfpierre merged commit 3caf1ff into master Feb 5, 2018
@mfpierre mfpierre deleted the mfpierre/config-check branch February 5, 2018 13:17
@hkaj
Copy link
Member

hkaj commented Feb 5, 2018

and thanks for the eyes @tmcarr, we'll fix it asap. Making troubleshooting easier is a high priority.

@mfpierre
Copy link
Contributor Author

mfpierre commented Feb 6, 2018

@hkaj static config errors added to the command output via #1189

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

Successfully merging this pull request may close these issues.

3 participants