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

Implemented cAdvisor as a container now how to use whitelisted_container_labels at run time? #3507

Open
Mahi242309 opened this issue Mar 22, 2024 · 0 comments

Comments

@Mahi242309
Copy link

[Unit]
Description=cAdvisor provides container-level monitoring and analysis of resource usage and performance characteristics.
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/bin/docker run
--volume=/:/rootfs:ro
--volume=/var/run:/var/run:ro
--volume=/sys:/sys:ro
--volume=/var/lib/docker/:/var/lib/docker:ro
--volume=/dev/disk/:/dev/disk:ro
--publish=8888:8080
--detach=true
--name=cadvisor
--privileged
--device=/dev/kmsg
gcr.io/cadvisor/cadvisor:latest

[Install]
WantedBy=multi-user.target

  1. I have tried adding them as below

--lebel store_container_labels=false
--lebel docker_only=true
--lebel whitelisted_container_labels=com.gitlab.gitlab-runner.job.id,com.gitlab.gitlab-runner.project.id,com.gitlab.gitlab-runner.job.url,com.gitlab.gitlab-runner.pipeline.id
gcr.io/cadvisor/cadvisor:latest

  1. and this way aswell

gcr.io/cadvisor/cadvisor:latest
--store_container_labels=false
--docker_only=true
--whitelisted_container_labels=com_gitlab_gitlab_runner_job_id,com_gitlab_gitlab_runner_project_id,com_gitlab_gitlab_runner_job_url,com_gitlab_gitlab_runner_pipeline_id

but the in second case the labels are taken as cmd args.

"Cmd": [
"--store_container_labels=false",
"--docker_only=true",
"--whitelisted_container_labels=com_gitlab_gitlab_runner_job_id,com_gitlab_gitlab_runner_project_id,com_gitlab_gitlab_runner_job_url,com_gitlab_gitlab_runner_pipeline_id"
],
"Labels": {}

In first case the metrics are odd but labels are set correctly.

"Labels": {
"docker_only": "true",
"store_container_labels": "false",
"whitelisted_container_labels": "com.gitlab.gitlab-runner.job.id,com.gitlab.gitlab-runner.project.id,com.gitlab.gitlab-runner.job.url,com.gitlab.gitlab-runner.pipeline.id"
}
},

but metrics are as below
container_tasks_state{container_label_docker_only="",container_label_store_container_labels="",container_label_whitelisted_container_labels="",id="/system.slice/systemd-journald.service",image="",name="",state="iowaiting"}

I need help with adding run time lables to cadvisor where cadvisor is implemented as a container

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

1 participant