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
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment