From 073b1084b702dd61f7ff92c41e85e2f983981da2 Mon Sep 17 00:00:00 2001 From: Joe Hofeditz Date: Fri, 3 Jul 2015 08:11:52 -0600 Subject: [PATCH] skip disk tags with no value Influxdb 0.9.1 now rejects writes with empty tag values. This patch skips tags with no values. A disk serial number does not exist for many devices including md raid arrays and VMs. Other plugins may also want to check for empty tags. --- plugins/system/disk.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/system/disk.go b/plugins/system/disk.go index cd5475962..1c5bdaef6 100644 --- a/plugins/system/disk.go +++ b/plugins/system/disk.go @@ -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)