From 680125d5b7cfa5248a2467b2666cb54d1e77df8c Mon Sep 17 00:00:00 2001 From: wanghe-fit2cloud Date: Sun, 20 Sep 2026 15:16:15 +0800 Subject: [PATCH] fix(disk): keep disk info when df exits with errors df still prints valid filesystems when a mount point cannot be queried (for example a stale FUSE mount), but exits non-zero. The dashboard and the disk alert discarded the whole output in that case, so no disk was displayed. Keep using the output whenever it is not empty. Refs #13864. --- agent/app/service/alert.go | 2 +- agent/app/service/dashboard.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/app/service/alert.go b/agent/app/service/alert.go index c981c88f9..34f020872 100644 --- a/agent/app/service/alert.go +++ b/agent/app/service/alert.go @@ -382,7 +382,7 @@ func executeDiskCommand() (string, error) { cmdMgr2 := cmd.NewCommandMgr(cmd.WithTimeout(1 * time.Second)) stdout, err = cmdMgr2.RunWithStdout("df", "-lhT", "-P") } - if err != nil { + if err != nil && strings.TrimSpace(stdout) == "" { return stdout, err } var lines []string diff --git a/agent/app/service/dashboard.go b/agent/app/service/dashboard.go index c41720e65..064dc5d7b 100644 --- a/agent/app/service/dashboard.go +++ b/agent/app/service/dashboard.go @@ -469,7 +469,7 @@ func loadDiskInfo() []dto.DiskInfo { cmd.PipeCommand{Name: "df", Args: []string{"-lhT", "-P"}}, cmd.PipeCommand{Name: "awk", Args: []string{format}}, ) - if err != nil { + if err != nil && strings.TrimSpace(stdout) == "" { return datas } }