diff --git a/main.go b/main.go index faee1a20413db4738dcee4ca0874d03f479d9fc0..d9687aa5535fd70059cdba13a422f124dc2e90be 100644 --- a/main.go +++ b/main.go @@ -85,6 +85,7 @@ type Exporter struct { jbodSlotStatus *prometheus.Desc licenseDaysLeft *prometheus.Desc volumeStatus *prometheus.Desc + volumeLunErrors *prometheus.Desc volumeLunStatus *prometheus.Desc } @@ -140,10 +141,16 @@ func NewExporter(uri string) *Exporter { []string{"volume", "state", "errors"}, prometheus.Labels{"host":*apiHost}, ), + volumeLunErrors: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "volume", "lun_errors"), + "Count of volume LUN errors.", + []string{"volume", "lun", "read", "write", "checksum"}, + prometheus.Labels{"host":*apiHost}, + ), volumeLunStatus: prometheus.NewDesc( prometheus.BuildFQName(namespace, "volume", "lun_status"), "Status of volume LUN.", - []string{"volume", "lun", "state", "errors", "group"}, + []string{"volume", "lun", "state", "group"}, prometheus.Labels{"host":*apiHost}, ), client: &http.Client{ @@ -162,6 +169,7 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { ch <- e.jbodVoltage ch <- e.jbodSlotStatus ch <- e.volumeStatus + ch <- e.volumeLunErrors ch <- e.volumeLunStatus } @@ -268,15 +276,16 @@ func (e *Exporter) getVolumeLuns(ch chan<- prometheus.Metric, volume string) err errorsWrite, _ := strconv.ParseFloat(data[2], 64) errorsChksum, _ := strconv.ParseFloat(data[3], 64) volumeLunErrors = errorsRead + errorsWrite + errorsChksum - labelErrors := strconv.FormatFloat(volumeLunErrors, 'f', 0, 64) if len(data) > 0 { if (data[5] != "spares" && data[0] == "ONLINE") || (data[5] == "spares" && data[0] == "AVAIL") { volumeLunStatus = 1 } } + ch <- prometheus.MustNewConstMetric(e.volumeLunErrors, prometheus.GaugeValue, volumeLunErrors, + volume, lun, data[1], data[2], data[3]) ch <- prometheus.MustNewConstMetric(e.volumeLunStatus, prometheus.GaugeValue, volumeLunStatus, - volume, lun, data[0], labelErrors, data[5]) + volume, lun, data[0], data[5]) } return err