From c350e8723086c2446ab6dd0b90e2ec2b40d51b6e Mon Sep 17 00:00:00 2001
From: Jan Grewe <jan.grewe@flixbus.com>
Date: Fri, 8 Jun 2018 10:42:24 +0200
Subject: [PATCH] Make volume LUN errors metric a counter

---
 README.md | 3 ++-
 main.go   | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 3c99970..9da41a5 100644
--- a/README.md
+++ b/README.md
@@ -19,12 +19,13 @@ Flag | Env Var | Default
 Metric | Type | Description
 --- | --- | ---
 `nexenta_up` | gauge | Is the Nexenta API reachable (0/1)
-`nexenta_scrape_failures_total` | counter |Number of errors while scraping the Nexenta API
+`nexenta_scrape_failures_total` | counter | Number of errors while scraping the Nexenta API
 `nexenta_jbod_status` | gauge | Status of JBOD (0/1)
 `nexenta_jbod_temp` | gauge | Temperature of JBOD (°C)
 `nexenta_jbod_voltage` | gauge | Voltage of JBOD (Volts)
 `nexenta_jbod_slot_status` | gauge | Status of JBOD slot (0/1)
 `nexenta_license_days_left` | gauge | License days left
 `nexenta_volume_status` | gauge | Is the volume online (0/1)
+`nexenta_volume_lun_errors` | count | Number of errors of a volume LUN
 `nexenta_volume_lun_status` | gauge | Is the volume LUN online (or available, if spare)(0/1)
 
diff --git a/main.go b/main.go
index d9687aa..9c9a6b1 100644
--- a/main.go
+++ b/main.go
@@ -143,7 +143,7 @@ func NewExporter(uri string) *Exporter {
 		),
 		volumeLunErrors: prometheus.NewDesc(
 			prometheus.BuildFQName(namespace, "volume", "lun_errors"),
-			"Count of volume LUN errors.",
+			"Number of volume LUN errors.",
 			[]string{"volume", "lun", "read", "write", "checksum"},
 			prometheus.Labels{"host":*apiHost},
 		),
@@ -282,7 +282,7 @@ func (e *Exporter) getVolumeLuns(ch chan<- prometheus.Metric, volume string) err
 				volumeLunStatus = 1
 			}
 		}
-		ch <- prometheus.MustNewConstMetric(e.volumeLunErrors, prometheus.GaugeValue, volumeLunErrors,
+		ch <- prometheus.MustNewConstMetric(e.volumeLunErrors, prometheus.CounterValue, volumeLunErrors,
 			volume, lun, data[1], data[2], data[3])
 		ch <- prometheus.MustNewConstMetric(e.volumeLunStatus, prometheus.GaugeValue, volumeLunStatus,
 			volume, lun, data[0], data[5])
-- 
GitLab