diff --git a/pkg/prom/collector.go b/pkg/prom/collector.go index 61af1da..f7ba293 100644 --- a/pkg/prom/collector.go +++ b/pkg/prom/collector.go @@ -163,6 +163,7 @@ func (c *solidfireCollector) Describe(ch chan<- *prometheus.Desc) { ch <- MetricDescriptions.ListDrivesCapacity ch <- MetricDescriptions.NodeISCSISessionsTotal + ch <- MetricDescriptions.NodeISCSIVolumes } func (c *solidfireCollector) Collect(ch chan<- prometheus.Metric) { @@ -1186,6 +1187,7 @@ func (c *solidfireCollector) Collect(ch chan<- prometheus.Metric) { for node, v := range sessions { for vol, val := range v { + ch <- prometheus.MustNewConstMetric( MetricDescriptions.NodeISCSISessionsTotal, prometheus.GaugeValue, @@ -1195,6 +1197,15 @@ func (c *solidfireCollector) Collect(ch chan<- prometheus.Metric) { strconv.Itoa(vol), volumeNamesByID[vol], ) + + ch <- prometheus.MustNewConstMetric( + MetricDescriptions.NodeISCSIVolumes, + prometheus.GaugeValue, + float64(node), + strconv.Itoa(vol), + volumeNamesByID[vol], + ) + } } diff --git a/pkg/prom/metrics.go b/pkg/prom/metrics.go index 2ae6f2e..54aadbb 100644 --- a/pkg/prom/metrics.go +++ b/pkg/prom/metrics.go @@ -144,6 +144,7 @@ type Descriptions struct { ListDrivesCapacity *prometheus.Desc NodeISCSISessionsTotal *prometheus.Desc + NodeISCSIVolumes *prometheus.Desc } func NewMetricDescriptions(namespace string) *Descriptions { @@ -957,5 +958,12 @@ func NewMetricDescriptions(namespace string) *Descriptions { nil, ) + d.NodeISCSIVolumes = prometheus.NewDesc( + prometheus.BuildFQName(namespace, "", "volume_node_id"), + "The node id where the volume is hosted.", + []string{"volume_id", "volume_name"}, + nil, + ) + return &d }