Skip to content

Commit

Permalink
Resolve linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Mar 21, 2024
1 parent e295299 commit 4d4c9b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions plugins/inputs/lustre2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
## Metrics

From `/sys/fs/lustre/health_check`:

- lustre2
- tags:
- fields:
Expand Down
8 changes: 4 additions & 4 deletions plugins/inputs/lustre2/lustre2.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,13 @@ func (*Lustre2) SampleConfig() string {
}

func (l *Lustre2) GetLustreHealth() error {
filename := filepath.Join(l.rootdir, "/sys/fs/lustre/health_check")
filename := filepath.Join(l.rootdir, "sys", "fs", "lustre", "health_check")
if _, err := os.Stat(filename); err != nil {
// try falling back to the old procfs location
// it was moved in https://github.com/lustre/lustre-release/commit/5d368bd0b2
filename = filepath.Join(l.rootdir, "/proc/fs/lustre/health_check")
filename = filepath.Join(l.rootdir, "proc", "fs", "lustre", "health_check")
if _, err = os.Stat(filename); err != nil {
return nil
return nil //nolint: nilerr // we don't want to return an error if the file doesn't exist
}
}
contents, err := os.ReadFile(filename)
Expand All @@ -395,7 +395,7 @@ func (l *Lustre2) GetLustreHealth() error {
}

value := strings.TrimSpace(string(contents))
var health uint64 = 0
var health uint64
if value == "healthy" {
health = 1
}
Expand Down

0 comments on commit 4d4c9b3

Please sign in to comment.