Merge pull request #407 from BryanQuigley/add_allowlists

enhancement: adding env/container labels options
This commit is contained in:
gardar 2024-09-13 14:02:33 +00:00 committed by GitHub
commit d38a289ebc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 0 deletions

View file

@ -11,6 +11,9 @@ cadvisor_prometheus_endpoint: "/metrics"
cadvisor_enable_metrics: []
cadvisor_disable_metrics: []
cadvisor_env_metadata_whitelist: []
cadvisor_whitelisted_container_labels: []
cadvisor_store_container_labels: true
cadvisor_docker_only: false
cadvisor_binary_install_dir: "/usr/local/bin"

View file

@ -64,6 +64,18 @@ argument_specs:
default: []
type: "list"
choices: *metrics_choices
cadvisor_store_container_labels:
description: "store all container labels"
type: "bool"
default: true
cadvisor_whitelisted_container_labels:
description: "comma-separated list of container labels to be used as labels on prometheus metrics"
default: []
type: "list"
cadvisor_env_metadata_whitelist:
description: "comma-separated list of env variables to be used as labels on prometheus metrics"
default: []
type: "list"
cadvisor_docker_only:
description: "do not report raw cgroup metrics, except the root cgroup"
type: "bool"

View file

@ -13,3 +13,6 @@ provisioner:
- network
- cpu
cadvisor_docker_only: true
whitelisted_container_labels: [ "com.docker.compose.image" ]
env_metadata_whitelist: [ "PATH" ]
store_container_labels: false

View file

@ -18,6 +18,13 @@ ExecStart={{ cadvisor_binary_install_dir }}/cadvisor \
{% if cadvisor_docker_only %}
'--docker_only={{ cadvisor_docker_only | lower }}' \
{% endif -%}
{% if cadvisor_whitelisted_container_labels | length > 0 %}
'--whitelisted_container_labels={{ cadvisor_whitelisted_container_labels | join(',') }}' \
{% endif -%}
{% if cadvisor_env_metadata_whitelist | length > 0 %}
'--env_metadata_whitelist={{ cadvisor_env_metadata_whitelist | join(',') }}' \
{% endif %}
'--store_container_labels={{ cadvisor_store_container_labels | lower }}' \
'--listen_ip={{ cadvisor_listen_ip }}' \
'--port={{ cadvisor_port }}' \
'--prometheus_endpoint={{ cadvisor_prometheus_endpoint }}'