From 1d546a409119069265ffb06047a429844ba854c5 Mon Sep 17 00:00:00 2001 From: henrygd Date: Sun, 2 Nov 2025 17:13:47 -0500 Subject: [PATCH 1/2] update nvidia dockerfile to build latest smartmontools (#1335) --- internal/dockerfile_agent_nvidia | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/internal/dockerfile_agent_nvidia b/internal/dockerfile_agent_nvidia index e6341732..2602f467 100644 --- a/internal/dockerfile_agent_nvidia +++ b/internal/dockerfile_agent_nvidia @@ -2,7 +2,6 @@ FROM --platform=$BUILDPLATFORM golang:alpine AS builder WORKDIR /app - COPY ../go.mod ../go.sum ./ RUN go mod download @@ -13,7 +12,24 @@ COPY . ./ ARG TARGETOS TARGETARCH RUN CGO_ENABLED=0 GOGC=75 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /agent ./internal/cmd/agent -RUN rm -rf /tmp/* +# -------------------------- +# Smartmontools builder stage +# -------------------------- +FROM nvidia/cuda:12.2.2-base-ubuntu22.04 AS smartmontools-builder + +RUN apt-get update && apt-get install -y \ + wget \ + build-essential \ + && wget https://downloads.sourceforge.net/project/smartmontools/smartmontools/7.5/smartmontools-7.5.tar.gz \ + && tar zxvf smartmontools-7.5.tar.gz \ + && cd smartmontools-7.5 \ + && ./configure --prefix=/usr --sysconfdir=/etc \ + && make \ + && make install \ + && rm -rf /smartmontools-7.5* \ + && apt-get remove -y wget build-essential \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* # -------------------------- # Final image: GPU-enabled agent with nvidia-smi @@ -21,10 +37,8 @@ RUN rm -rf /tmp/* FROM nvidia/cuda:12.2.2-base-ubuntu22.04 COPY --from=builder /agent /agent -# this is so we don't need to create the /tmp directory in the scratch container -COPY --from=builder /tmp /tmp - -RUN apt-get update && apt-get install -y smartmontools && rm -rf /var/lib/apt/lists/* +# Copy smartmontools binaries and config files +COPY --from=smartmontools-builder /usr/sbin/smartctl /usr/sbin/smartctl # Ensure data persistence across container recreations VOLUME ["/var/lib/beszel-agent"] From fc0947aa04fddb933f1a346ec239a6fbff385a9a Mon Sep 17 00:00:00 2001 From: henrygd Date: Mon, 3 Nov 2025 17:42:08 -0500 Subject: [PATCH 2/2] fix windows extra disk backslash issue (#1361) --- agent/disk.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/agent/disk.go b/agent/disk.go index 6cd5dcc4..88567979 100644 --- a/agent/disk.go +++ b/agent/disk.go @@ -31,6 +31,7 @@ func (a *Agent) initializeDiskInfo() { filesystem, _ := GetEnv("FILESYSTEM") efPath := "/extra-filesystems" hasRoot := false + isWindows := runtime.GOOS == "windows" partitions, err := disk.Partitions(false) if err != nil { @@ -38,6 +39,13 @@ func (a *Agent) initializeDiskInfo() { } slog.Debug("Disk", "partitions", partitions) + // trim trailing backslash for Windows devices (#1361) + if isWindows { + for i, p := range partitions { + partitions[i].Device = strings.TrimSuffix(p.Device, "\\") + } + } + // ioContext := context.WithValue(a.sensorsContext, // common.EnvKey, common.EnvMap{common.HostProcEnvKey: "/tmp/testproc"}, // ) @@ -52,7 +60,7 @@ func (a *Agent) initializeDiskInfo() { // Helper function to add a filesystem to fsStats if it doesn't exist addFsStat := func(device, mountpoint string, root bool, customName ...string) { var key string - if runtime.GOOS == "windows" { + if isWindows { key = device } else { key = filepath.Base(device)