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

Disk Usage Check Fails to Monitor Host Filesystem in Docker Containers #448

Open
kilemensi opened this issue Feb 27, 2025 · 0 comments
Open

Comments

@kilemensi
Copy link

Description

The current DiskUsage health check backend hardcodes the monitored path as /. This works fine when running natively. However, within a Docker container, it checks the container's root filesystem, and not the host's.

This makes the health check less useful in containerized environments, as it doesn't reflect the actual disk usage of the underlying host.

Suggestion

To enable monitoring the host's disk usage from within a container, a possible approach is to:

  1. Allow configuration of the disk usage path via a setting (e.g., HEALTH_CHECK['DISK_USAGE_PATH']).
  2. If HEALTH_CHECK['DISK_USAGE_PATH'] is set, use that path for psutil.disk_usage(). Otherwise, default to / for backward compatibility and non-containerized environments.

This would allow users to mount the host's filesystem to a specific path within the container (e.g., /host/) and then configure HEALTH_CHECK['DISK_USAGE_PATH'] to /host/ to monitor the correct disk usage.

This is the approach used by other monitoring solutions such as Prometheus' node_exporter


Happy to send a PR if you agree with the approach.

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