added node_md_sync_minutes_remaining, node_md_blocks_synced_speed and node_md_blocks_synced_pct

Signed-off-by: Finomosec <github@meinebasis.de>
This commit is contained in:
Finomosec 2024-05-01 11:51:47 +02:00
parent 21be96076a
commit 58f48d177c

View file

@ -99,6 +99,24 @@ var (
[]string{"device"}, []string{"device"},
nil, nil,
) )
blocksSyncedPctDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "md", "blocks_synced_pct"),
"Percentage of blocks synced on device.",
[]string{"device"},
nil,
)
syncMinutesRemainingDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "md", "sync_minutes_remaining"),
"Estimated finishing time for current sync in minutes.",
[]string{"device"},
nil,
)
blockSyncedSpeedDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "md", "blocks_synced_speed"),
"current sync speed (in Kilobytes/sec)",
[]string{"device"},
nil,
)
) )
func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error { func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error {
@ -206,6 +224,25 @@ func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error {
float64(mdStat.BlocksSynced), float64(mdStat.BlocksSynced),
mdStat.Name, mdStat.Name,
) )
ch <- prometheus.MustNewConstMetric(
blocksSyncedPctDesc,
prometheus.GaugeValue,
float64(mdStat.BlocksSyncedPct),
mdStat.Name,
)
ch <- prometheus.MustNewConstMetric(
syncMinutesRemainingDesc,
prometheus.GaugeValue,
float64(mdStat.BlocksSyncedFinishTime),
mdStat.Name,
)
ch <- prometheus.MustNewConstMetric(
blockSyncedSpeedDesc,
prometheus.GaugeValue,
float64(mdStat.BlocksSyncedSpeed),
mdStat.Name,
)
} }
return nil return nil