diff --git a/engine/cdn/storage/nfs/nfs.go b/engine/cdn/storage/nfs/nfs.go index ffc1bf03cb..53aa4a6c31 100644 --- a/engine/cdn/storage/nfs/nfs.go +++ b/engine/cdn/storage/nfs/nfs.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "strings" "time" "github.com/go-gorp/gorp" @@ -185,8 +186,8 @@ func (n *Buffer) Status(_ context.Context) []sdk.MonitoringStatusLine { Status: n.pingStatus, }, { - Component: fmt.Sprintf("storage/%s/redis_dbsize", n.Name()), - Value: fmt.Sprintf("%d keys", n.size), + Component: fmt.Sprintf("storage/%s/size", n.Name()), + Value: fmt.Sprintf("%d octets", n.size), Status: sdk.MonitoringStatusOK, }} } @@ -299,6 +300,7 @@ func (n *Buffer) dirSize() (int64, error) { defer dial.Close() // nolint defer target.Close() // n.pingStatus = sdk.MonitoringStatusOK + return n.computeDirSizeRecursive(target, ".") } @@ -309,7 +311,7 @@ func (n *Buffer) computeDirSizeRecursive(v *gonfs.Target, path string) (int64, e return 0, err } for _, e := range entries { - if e.FileName == "." || e.FileName == ".." { + if strings.HasPrefix(e.FileName, ".") { continue } if e.IsDir() {