46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
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
|
|
}
|
|
}
|