diff --git a/README.md b/README.md index f24d9cf07f48e1aba4d29a4eee0aad2704504fee..f238b3285ec2de0f342ec43176185d0f967c77b6 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,5 @@ Metric | Type | Description `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_volume_online` | gauge | Is the volume online (0/1) +`nexenta_volume_status` | gauge | Is the volume online (0/1) `nexenta_license_days_left` | gauge | License days left diff --git a/main.go b/main.go index 76bf352aed54110c2e95a9dd6e2c238fbfee2378..5e550abb25e48ace27a343c8f495a1c1512de392 100644 --- a/main.go +++ b/main.go @@ -78,7 +78,7 @@ type Exporter struct { up *prometheus.Desc scrapeFailures prometheus.Counter - volumeOnline *prometheus.Desc + volumeStatus *prometheus.Desc jbodStatus *prometheus.Desc jbodTemp *prometheus.Desc jbodVoltage *prometheus.Desc @@ -101,10 +101,10 @@ func NewExporter(uri string) *Exporter { Help: "Number of errors while scraping the Nexenta API", ConstLabels: prometheus.Labels{"host":*apiHost}, }), - volumeOnline: prometheus.NewDesc( - prometheus.BuildFQName(namespace, "volume", "online"), + volumeStatus: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "volume", "status"), "Status of volume.", - []string{"volume"}, + []string{"volume", "state", "errors"}, prometheus.Labels{"host":*apiHost}, ), jbodStatus: prometheus.NewDesc( @@ -148,7 +148,7 @@ func NewExporter(uri string) *Exporter { func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { ch <- e.up e.scrapeFailures.Describe(ch) - ch <- e.volumeOnline + ch <- e.volumeStatus ch <- e.jbodStatus ch <- e.jbodTemp ch <- e.jbodVoltage @@ -233,7 +233,7 @@ func (e *Exporter) getVolumeStatus(ch chan<- prometheus.Metric, volume string) e if volumeStatus.State[0] == "ONLINE" { volumeOnline = 1 } } - ch <- prometheus.MustNewConstMetric(e.volumeOnline, prometheus.GaugeValue, volumeOnline, volume) + ch <- prometheus.MustNewConstMetric(e.volumeStatus, prometheus.GaugeValue, volumeOnline, volume, volumeStatus.State[0], volumeStatus.Errors[0]) return err }