Skip to content

Commit

Permalink
Merge pull request #6 from nixwiz/reorder_checks
Browse files Browse the repository at this point in the history
reorder checks
  • Loading branch information
Todd Campbell authored Dec 30, 2020
2 parents 1385797 + fbe73cd commit 2b87fbc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
- Moved included/excluded checks against partition information up before querying usage

## [0.2.0] - 2020-12-30

### Added
Expand Down
20 changes: 10 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ func executeCheck(event *types.Event) (int, error) {
}

for _, p := range parts {
// Ignore excluded (or non-included) file system types
if !isValidFSType(p.Fstype) {
continue
}

// Ignore excluded (or non-included) file systems
if !isValidFSPath(p.Mountpoint) {
continue
}

device := p.Mountpoint
s, err := disk.Usage(device)
if err != nil {
Expand All @@ -152,16 +162,6 @@ func executeCheck(event *types.Event) (int, error) {
continue
}

// Ignore excluded (or non-included) file system types
if !isValidFSType(p.Fstype) {
continue
}

// Ignore excluded (or non-included) file systems
if !isValidFSPath(p.Mountpoint) {
continue
}

// implement magic factor for larger file systems?
fmt.Printf("%s ", plugin.PluginConfig.Name)
if s.UsedPercent >= plugin.Critical {
Expand Down

0 comments on commit 2b87fbc

Please sign in to comment.