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

Docker input: add include/exclude filters for container names. #2734

Closed
m4ce opened this issue Apr 28, 2017 · 6 comments
Closed

Docker input: add include/exclude filters for container names. #2734

m4ce opened this issue Apr 28, 2017 · 6 comments
Labels
area/docker feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@m4ce
Copy link
Contributor

m4ce commented Apr 28, 2017

It would be handy if the docker input plugin supported (regex) patterns in container names.

## Only collect metrics for these containers, collect all if empty
  container_names = []

It'd be even nicer to have an include/exclude boolean option to drive the logic behind container_names.

Also, I noticed the plugin keeps reporting metrics for containers in exit state. Not sure what the reason is behind this, but maybe one can provide an option to disable this behavior?

@danielnelson
Copy link
Contributor

The standard way we would do this is to have an include list and an exclude list, both would have glob patterns. The same as for tagpass/tagdrop.

I'm open to regex but we need to decide on a nice way to expose them in a backwards compatible way, there was a little discussion about this yesterday on #2726.

Also, I noticed the plugin keeps reporting metrics for containers in exit state. Not sure what the reason is behind this, but maybe one can provide an option to disable this behavior?

Seems like a nice feature, can you open a separate feature request for this? I'm going to rename this issue for the first request.

@danielnelson danielnelson changed the title Docker input plugin enhancements Docker input: add include/exclude filters for container names. Apr 28, 2017
@danielnelson danielnelson added the feature request Requests for new plugin and for new features to existing plugins label Apr 28, 2017
@m4ce
Copy link
Contributor Author

m4ce commented Apr 28, 2017

@danielnelson, sounds good.

One could add two more configuration parameters which should deprecate the container_names option in the future.

  • include_container_names
  • exclude_container_names

I'd suggest aliasing container_names to include_container_names. If users are using container_names, each element can be turned into a regex like '^name$'. This will keep backwards compatibility.

@danielnelson
Copy link
Contributor

Lets name them container_name_include and container_name_exclude? For now lets only add glob support, I want to think about regex support a bit more.

@m4ce
Copy link
Contributor Author

m4ce commented May 15, 2017

@danielnelson,

I will get started on this. Would you want to retain the current container_name option for backward compatibility?

@danielnelson
Copy link
Contributor

Yeah, leave the current option in but document it as deprecated. Thanks

m4ce pushed a commit to m4ce/telegraf that referenced this issue May 16, 2017
adding wildcard support for container inclusion/exclusion. Solves influxdata#2734.
m4ce pushed a commit to m4ce/telegraf that referenced this issue May 16, 2017
adding wildcard support for container inclusion/exclusion. Solves influxdata#2734.
@danielnelson
Copy link
Contributor

Merged for 1.4.0

@danielnelson danielnelson added this to the 1.4.0 milestone Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docker feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

2 participants