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 env variables to podman_container_info #295

Open
dmennecke1 opened this issue Oct 23, 2024 · 1 comment
Open

Add env variables to podman_container_info #295

dmennecke1 opened this issue Oct 23, 2024 · 1 comment

Comments

@dmennecke1
Copy link

dmennecke1 commented Oct 23, 2024

We would love to list the container environment variables in Grafana using Prometheus as a datasource. When running podman_container_info{name="db"} i get

podman_container_info{id="50bd8e611a8e", image="localhost/postgres:latest", instance="localhost:9882", job="ppe", name="db", pod_id="0070d18cd8ab", pod_name="msx", ports="0.0.0.0:4201->420/tcp"}

Is there a way to add the env variables (e.g. coming from podman run -e) like so:

podman_container_info{id="50bd8e611a8e", image="localhost/postgres:latest", instance="localhost:9882", job="ppe", name="db", pod_id="0070d18cd8ab", pod_name="msx", ports="0.0.0.0:4201->420/tcp", env_vars="{db_name:'postgres', db_version: 1}"}
@navidys
Copy link
Collaborator

navidys commented Oct 26, 2024

Hi @dmennecke1

I might add a new metric podman_container_env or add it to podman_container_info itself.

Not sure if its useful for you but you can add db_name and db_version as a label to your container/pod and use --collector.store_labels option to add it to the exported metrics.

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

2 participants