Skip to content

Commit

Permalink
Merge pull request #45 from jhofeditz/patch-1
Browse files Browse the repository at this point in the history
skip disk tags with no value
  • Loading branch information
toddboom committed Jul 5, 2015
2 parents 494704b + 073b108 commit 1d8e647
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/system/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ func (s *DiskIOStats) Gather(acc plugins.Accumulator) error {
}

for _, io := range diskio {
tags := map[string]string{
"name": io.Name,
"serial": io.SerialNumber,
tags := map[string]string{}
if len(io.Name) != 0 {
tags["name"] = io.Name
}
if len(io.SerialNumber) != 0 {
tags["serial"] = io.SerialNumber
}

acc.Add("reads", io.ReadCount, tags)
Expand Down

0 comments on commit 1d8e647

Please sign in to comment.