Added parity status metrics
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
45
collector.go
Normal file
45
collector.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type UnraidCollector struct {
|
||||
parityStatusMetric *prometheus.Desc
|
||||
parityProgressMetric *prometheus.Desc
|
||||
parityErrorCountMetric *prometheus.Desc
|
||||
|
||||
metrics []prometheus.Metric
|
||||
}
|
||||
|
||||
func newUnraidCollector() *UnraidCollector {
|
||||
return &UnraidCollector{
|
||||
parityStatusMetric: prometheus.NewDesc("unraid_parity_check_status",
|
||||
"Parity check status of the Unraid array",
|
||||
[]string{"status"},
|
||||
nil,
|
||||
),
|
||||
parityProgressMetric: prometheus.NewDesc("unraid_parity_check_progress",
|
||||
"Parity check progress percentage",
|
||||
nil, nil,
|
||||
),
|
||||
parityErrorCountMetric: prometheus.NewDesc("unraid_parity_check_error_count",
|
||||
"Parity check error count",
|
||||
nil, nil,
|
||||
),
|
||||
|
||||
metrics: []prometheus.Metric{},
|
||||
}
|
||||
}
|
||||
|
||||
func (collector *UnraidCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
ch <- collector.parityStatusMetric
|
||||
ch <- collector.parityProgressMetric
|
||||
ch <- collector.parityErrorCountMetric
|
||||
}
|
||||
|
||||
func (collector *UnraidCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
for _, m := range collector.metrics {
|
||||
ch <- m
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user