From 4b99d9a6b8513bfc9a315bd14f09cedbb5c71167 Mon Sep 17 00:00:00 2001 From: William Jimenez Date: Thu, 21 Dec 2017 13:37:32 -0800 Subject: [PATCH] handle case where we can't read docker storage info --- main.go | 8 +++++--- vendor.conf | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 8e6fe81..d5a3513 100644 --- a/main.go +++ b/main.go @@ -210,15 +210,17 @@ func (c *CheckStorage) eval() bool { } promDockerDataStorageFree.Set(float64(dataSpaceFree)) logrus.Debugf("Found 'Data Space Available' value of ", item[1]) - } - - if item[0] == "Metadata Space Available" { + } else if item[0] == "Metadata Space Available" { metadataSpaceFree, err = humanize.ParseBytes(item[1]) if err != nil { panic(err) } promDockerMetadataStorageFree.Set(float64(metadataSpaceFree)) logrus.Debugf("Found 'Metadata Space Available' value of ", item[1]) + } else { + // we didn't find any of our storage keys + logrus.Error("Didn't find storage information from Docker API. Skipping storage evaluation") + return true } } diff --git a/vendor.conf b/vendor.conf index 11818d8..fcce800 100644 --- a/vendor.conf +++ b/vendor.conf @@ -2,6 +2,9 @@ github.com/wjimenez5271/cowcheck github.com/Sirupsen/logrus v0.10.0 -github.com/urfave/cli v1.18.0 github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76 -github.com/miekg/dns 113c7538ea6d8f429071f901bd26af59cc9676fe \ No newline at end of file +github.com/miekg/dns 113c7538ea6d8f429071f901bd26af59cc9676fe +github.com/docker/docker/client v17.03.2-ce +github.com/dustin/go-humanize bb3d318650d48840a39aa21a027c6630e198e626 +github.com/prometheus/client_golang/prometheus 661e31bf844dfca9aeba15f27ea8aa0d485ad212 +github.com/prometheus/client_golang/prometheus/promhttp 661e31bf844dfca9aeba15f27ea8aa0d485ad212