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

[Bug]: Monitoring Docker on Windows cause error #488

Open
Eisaichen opened this issue Jan 24, 2025 · 2 comments
Open

[Bug]: Monitoring Docker on Windows cause error #488

Eisaichen opened this issue Jan 24, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Eisaichen
Copy link

Description

2025/01/24 13:06:16 ERROR Error getting container stats err="container2 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:06:16 ERROR Error getting container stats err="container1 - no memory stats - see https://github.com/henrygd/beszel/issues/144"

This error occurs for every update cycle. No data for "Docker Memory Usage" in the Hub.
This is not related to #144, docker stats is able to run.
The cause seems obvious, Docker on Windows doesn't report memory usage in the same format as Linux.

# Windows
CONTAINER ID   NAME       CPU %     PRIV WORKING SET   NET I/O          BLOCK I/O
f66a34bf45ca   container1   0.00%     269.9MiB           470MB / 7.26MB   2.07GB / 2.05GB
5a9f7dab0b95   container2     0.00%     57.12MiB           310MB / 10.9MB   5.1GB / 7.18GB


# Linux
CONTAINER ID   NAME           CPU %     MEM USAGE / LIMIT     MEM %     NET I/O       BLOCK I/O   PIDS
2f5895f9a7c4   busy_neumann   0.00%     1.984MiB / 15.23GiB   0.01%     1.11kB / 0B   0B / 0B     1

Expected Behavior

Report container memory usage data as designed.

Steps to Reproduce

  1. Run some Windows Containers.
  2. Setup DOCKER_HOST for beszel agent.
  3. observe the error.

OS / Architecture

Windows/amd64 (agent), Linux/amd64 (Hub)

Beszel version

0.9.1

Installation method

Binary

Configuration

Hub Logs

Agent Logs

2025/01/24 13:03:28 INFO Detected root device name=\
2025/01/24 13:03:28 WARN Device not found in diskstats name=\
2025/01/24 13:03:28 INFO DOCKER_HOST host=tcp://127.0.0.1:2375
2025/01/24 13:03:28 INFO Starting SSH server address=:45876
2025/01/24 13:04:16 ERROR Error getting container stats err="container1 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:04:16 ERROR Error getting container stats err="container2 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:05:16 ERROR Error getting container stats err="container2 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:05:16 ERROR Error getting container stats err="container1 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:06:16 ERROR Error getting container stats err="container2 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:06:16 ERROR Error getting container stats err="container1 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
2025/01/24 13:07:16 ERROR Error getting container stats err="container1 - no memory stats - see https://github.com/henrygd/beszel/issues/144"
@Eisaichen Eisaichen added the bug Something isn't working label Jan 24, 2025
@henrygd
Copy link
Owner

henrygd commented Jan 29, 2025

I'll try to check out the Windows bugs this week or over the weekend.

If you get a chance, can you try to hit the stats endpoint directly and let me know what you get?

curl --unix-socket //./pipe/docker_engine "http://localhost/containers/YOUR_CONTAINER_NAME/stats?stream=0&one-shot=1"

(I haven't tested this command directly on windows yet so it may not work.)

@Eisaichen
Copy link
Author

Eisaichen commented Jan 29, 2025

I think Windows doesn't have a Unix socket, which is also why I exposed the dockerd through HTTP. the API call is succeeded without socket argument.

linux:~$ curl --unix-socket //./pipe/docker_engine "http://192.168.1.1:2375/containers/container1/stats?stream=0&one-shot=1"
curl: (7) Couldn't connect to server

linux:~$ nc -vz 192.168.1.1 2375
Connection to 192.168.1.1 2375 port [tcp/*] succeeded!

linux:~$ curl "http://192.168.1.1:2375/containers/container1/stats?stream=0&one-shot=1"
{"read":"2025-01-28T21:31:25.1723024-06:00","preread":"0001-01-01T00:00:00Z","pids_stats":{},"blkio_stats":{"io_service_bytes_recursive":null,"io_serviced_recursive":null,"io_queue_recursive":null,"io_service_time_recursive":null,"io_wait_time_recursive":null,"io_merged_recursive":null,"io_time_recursive":null,"sectors_recursive":null},"num_procs":16,"storage_stats":{"read_count_normalized":841825,"read_size_bytes":5629033472,"write_count_normalized":622312,"write_size_bytes":4672738816},"cpu_stats":{"cpu_usage":{"total_usage":5768125000,"usage_in_kernelmode":2231093750,"usage_in_usermode":3537031250},"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"precpu_stats":{"cpu_usage":{"total_usage":0,"usage_in_kernelmode":0,"usage_in_usermode":0},"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"memory_stats":{"commitbytes":482381824,"commitpeakbytes":891002880,"privateworkingset":247332864},"networks":{"B7CD3EF9-85BD-47AA-9D6A-6864A96593F4":{"rx_bytes":515498421,"rx_packets":369265,"rx_errors":0,"rx_dropped":106,"tx_bytes":34068836,"tx_packets":84887,"tx_errors":0,"tx_dropped":0}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants