Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pkg/snclient/check_drivesize_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"fmt"
"os"
"path/filepath"
"strings"

"github.com/consol-monitoring/snclient/pkg/utils"
Expand Down Expand Up @@ -116,6 +117,16 @@ func (l *CheckDrivesize) setCustomPath(path string, requiredDisks map[string]map
if path == vol["drive"] {
match = &vol

break
}
if path == fmt.Sprintf("%s%c", vol["drive"], filepath.Separator) {
match = &vol

log.Debugf("For search path: '%s', taking drive: '%s' since adding a separator: '%s' matches the search path: '%s' ", path, vol["drive"], string(filepath.Separator), path)

// correct search path so that it looks uniform with the drivename in perfdata
path = strings.TrimSuffix(path, string(filepath.Separator))

break
}
}
Expand All @@ -130,7 +141,7 @@ func (l *CheckDrivesize) setCustomPath(path string, requiredDisks map[string]map
// add anyway to generate an error later with more default values filled in
entry := l.driveEntry(path)
entry["_error"] = (&PartitionNotMountedError{
Path: path, err: fmt.Errorf("path :%s does exist, but could not match it to a drive. its likely that the partition is not mounted", path),
Path: path, err: fmt.Errorf("path :%s does exist, but could not match it to a drive. its likely that the partition does not exist or is not mounted", path),
}).Error()
requiredDisks[path] = entry

Expand Down
Loading