cmd/scollector: skip md volumes if mdadm binary is missing #1850

Merged
merged 1 commit into from Aug 5, 2016

Conversation

Projects
None yet
2 participants
@dimamedvedev
Contributor

dimamedvedev commented Aug 4, 2016

Rarely there are /dev/md* files but no mdadm installed.

cmd/scollector/collectors/disk_linux.go
@@ -169,7 +169,10 @@ func examineMdadmVolume(volumeName string) (volumeDetail, error) {
// We don't use --test because it has failed us in the past.
// Maybe we should use it sometime in the future
output, err := util.Command(tmout, nil, "mdadm", "--detail", volumeName)
- detail := parseExamineMdadm(output)
+ detail := volumeDetail{}

This comment has been minimized.

@captncraig

captncraig Aug 5, 2016

Contributor

Just a minor thing. I'm much more used to seeing if err != nil blocks. How about:

if err != nil{
   return volumeDetail{}, err
}
return parseExamineMdadm(output), nil
@captncraig

captncraig Aug 5, 2016

Contributor

Just a minor thing. I'm much more used to seeing if err != nil blocks. How about:

if err != nil{
   return volumeDetail{}, err
}
return parseExamineMdadm(output), nil
@dimamedvedev

This comment has been minimized.

Show comment
Hide comment
@dimamedvedev

dimamedvedev Aug 5, 2016

Contributor

Thank you for a quick answer, Craig.
Yeah, your suggestion is way prettier.

Contributor

dimamedvedev commented Aug 5, 2016

Thank you for a quick answer, Craig.
Yeah, your suggestion is way prettier.

@captncraig captncraig merged commit fa86001 into bosun-monitor:master Aug 5, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment