Skip to content
Snippets Groups Projects
Commit 717a7470 authored by Jan Grewe's avatar Jan Grewe
Browse files

Move Volume LUN 'errors' label to separate metric 'nexenta_volume_lun_errors'

parent 7d077b7e
Branches
No related tags found
No related merge requests found
...@@ -85,6 +85,7 @@ type Exporter struct { ...@@ -85,6 +85,7 @@ type Exporter struct {
jbodSlotStatus *prometheus.Desc jbodSlotStatus *prometheus.Desc
licenseDaysLeft *prometheus.Desc licenseDaysLeft *prometheus.Desc
volumeStatus *prometheus.Desc volumeStatus *prometheus.Desc
volumeLunErrors *prometheus.Desc
volumeLunStatus *prometheus.Desc volumeLunStatus *prometheus.Desc
} }
...@@ -140,10 +141,16 @@ func NewExporter(uri string) *Exporter { ...@@ -140,10 +141,16 @@ func NewExporter(uri string) *Exporter {
[]string{"volume", "state", "errors"}, []string{"volume", "state", "errors"},
prometheus.Labels{"host":*apiHost}, 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( volumeLunStatus: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "volume", "lun_status"), prometheus.BuildFQName(namespace, "volume", "lun_status"),
"Status of volume LUN.", "Status of volume LUN.",
[]string{"volume", "lun", "state", "errors", "group"}, []string{"volume", "lun", "state", "group"},
prometheus.Labels{"host":*apiHost}, prometheus.Labels{"host":*apiHost},
), ),
client: &http.Client{ client: &http.Client{
...@@ -162,6 +169,7 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { ...@@ -162,6 +169,7 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
ch <- e.jbodVoltage ch <- e.jbodVoltage
ch <- e.jbodSlotStatus ch <- e.jbodSlotStatus
ch <- e.volumeStatus ch <- e.volumeStatus
ch <- e.volumeLunErrors
ch <- e.volumeLunStatus ch <- e.volumeLunStatus
} }
...@@ -268,15 +276,16 @@ func (e *Exporter) getVolumeLuns(ch chan<- prometheus.Metric, volume string) err ...@@ -268,15 +276,16 @@ func (e *Exporter) getVolumeLuns(ch chan<- prometheus.Metric, volume string) err
errorsWrite, _ := strconv.ParseFloat(data[2], 64) errorsWrite, _ := strconv.ParseFloat(data[2], 64)
errorsChksum, _ := strconv.ParseFloat(data[3], 64) errorsChksum, _ := strconv.ParseFloat(data[3], 64)
volumeLunErrors = errorsRead + errorsWrite + errorsChksum volumeLunErrors = errorsRead + errorsWrite + errorsChksum
labelErrors := strconv.FormatFloat(volumeLunErrors, 'f', 0, 64)
if len(data) > 0 { if len(data) > 0 {
if (data[5] != "spares" && data[0] == "ONLINE") || if (data[5] != "spares" && data[0] == "ONLINE") ||
(data[5] == "spares" && data[0] == "AVAIL") { (data[5] == "spares" && data[0] == "AVAIL") {
volumeLunStatus = 1 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, ch <- prometheus.MustNewConstMetric(e.volumeLunStatus, prometheus.GaugeValue, volumeLunStatus,
volume, lun, data[0], labelErrors, data[5]) volume, lun, data[0], data[5])
} }
return err return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment