Updated code to add label to size and partition

Signed-off-by: sixfears7 <57415489+6fears7@users.noreply.github.com>
Signed-off-by: pgibbs1 <pgibbs1@liberty.edu>
This commit is contained in:
sixfears7 2022-11-18 14:57:21 -05:00 committed by pgibbs1
parent 9a2ef3fca8
commit 586152a4ad
1 changed files with 6 additions and 4 deletions

View File

@ -56,14 +56,14 @@ func newDiskDriveInfoCollector() (Collector, error) {
Size: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "size"),
"Size of the disk drive. It is calculated by multiplying the total number of cylinders, tracks in each cylinder, sectors in each track, and bytes in each sector.",
nil,
[]string{"name"},
nil,
),
Partitions: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "partitions"),
"Number of partitions",
nil,
[]string{"name"},
nil,
),
@ -178,13 +178,15 @@ func (c *DiskDriveInfoCollector) collect(ch chan<- prometheus.Metric) (*promethe
ch <- prometheus.MustNewConstMetric(
c.Size,
prometheus.CounterValue,
float64(dst[0].Size),
float64(processor.Size),
strings.Trim(processor.Name, "\\.\\"),
)
ch <- prometheus.MustNewConstMetric(
c.Partitions,
prometheus.CounterValue,
float64(dst[0].Partitions),
float64(processor.Partitions),
strings.Trim(processor.Name, "\\.\\"),
)
for availNum, val := range availMap {