From 21be96076a3933c2a873e3e7aa0cf517c3b220ef Mon Sep 17 00:00:00 2001 From: Finomosec Date: Tue, 30 Apr 2024 01:57:41 +0200 Subject: [PATCH 01/11] added md disks in down state Signed-off-by: Finomosec --- collector/mdadm_linux.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index 89c56b75..8e6d2fb5 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -131,7 +131,13 @@ func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error { float64(mdStat.DisksTotal), mdStat.Name, ) - + ch <- prometheus.MustNewConstMetric( + disksDesc, + prometheus.GaugeValue, + float64(mdStat.DisksDown), + mdStat.Name, + "down", + ) ch <- prometheus.MustNewConstMetric( disksDesc, prometheus.GaugeValue, From 58f48d177c7ef3ce5c10964f60845580341848ca Mon Sep 17 00:00:00 2001 From: Finomosec Date: Wed, 1 May 2024 11:51:47 +0200 Subject: [PATCH 02/11] added node_md_sync_minutes_remaining, node_md_blocks_synced_speed and node_md_blocks_synced_pct Signed-off-by: Finomosec --- collector/mdadm_linux.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index 8e6d2fb5..bcccd377 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -99,6 +99,24 @@ var ( []string{"device"}, 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 { @@ -206,6 +224,25 @@ func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error { float64(mdStat.BlocksSynced), 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 From 27b93f822765f8b25ec1f6c953468d7eda550b10 Mon Sep 17 00:00:00 2001 From: Finomosec Date: Wed, 1 May 2024 11:58:06 +0200 Subject: [PATCH 03/11] fixed unit-test expected output Signed-off-by: Finomosec --- collector/fixtures/e2e-output.txt | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index d52cb99d..c2ece281 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1581,57 +1581,112 @@ node_md_blocks_synced{device="md6"} 1.6775552e+07 node_md_blocks_synced{device="md7"} 7.813735424e+09 node_md_blocks_synced{device="md8"} 1.6775552e+07 node_md_blocks_synced{device="md9"} 0 +# HELP node_md_blocks_synced_pct Percentage of blocks synced on device. +# TYPE node_md_blocks_synced_pct gauge +node_md_blocks_synced_pct{device="md0"} 0 +node_md_blocks_synced_pct{device="md00"} 0 +node_md_blocks_synced_pct{device="md10"} 0 +node_md_blocks_synced_pct{device="md101"} 0 +node_md_blocks_synced_pct{device="md11"} 0 +node_md_blocks_synced_pct{device="md12"} 0 +node_md_blocks_synced_pct{device="md120"} 0 +node_md_blocks_synced_pct{device="md126"} 0 +node_md_blocks_synced_pct{device="md127"} 0 +node_md_blocks_synced_pct{device="md201"} 5.7 +node_md_blocks_synced_pct{device="md219"} 0 +node_md_blocks_synced_pct{device="md3"} 0 +node_md_blocks_synced_pct{device="md4"} 0 +node_md_blocks_synced_pct{device="md6"} 8.5 +node_md_blocks_synced_pct{device="md7"} 0 +node_md_blocks_synced_pct{device="md8"} 8.5 +node_md_blocks_synced_pct{device="md9"} 0 +# HELP node_md_blocks_synced_speed current sync speed (in Kilobytes/sec) +# TYPE node_md_blocks_synced_speed gauge +node_md_blocks_synced_speed{device="md0"} 0 +node_md_blocks_synced_speed{device="md00"} 0 +node_md_blocks_synced_speed{device="md10"} 0 +node_md_blocks_synced_speed{device="md101"} 0 +node_md_blocks_synced_speed{device="md11"} 0 +node_md_blocks_synced_speed{device="md12"} 0 +node_md_blocks_synced_speed{device="md120"} 0 +node_md_blocks_synced_speed{device="md126"} 0 +node_md_blocks_synced_speed{device="md127"} 0 +node_md_blocks_synced_speed{device="md201"} 114176 +node_md_blocks_synced_speed{device="md219"} 0 +node_md_blocks_synced_speed{device="md3"} 0 +node_md_blocks_synced_speed{device="md4"} 0 +node_md_blocks_synced_speed{device="md6"} 259783 +node_md_blocks_synced_speed{device="md7"} 0 +node_md_blocks_synced_speed{device="md8"} 259783 +node_md_blocks_synced_speed{device="md9"} 0 # HELP node_md_disks Number of active/failed/spare disks of device. # TYPE node_md_disks gauge node_md_disks{device="md0",state="active"} 2 +node_md_disks{device="md0",state="down"} 0 node_md_disks{device="md0",state="failed"} 0 node_md_disks{device="md0",state="spare"} 0 node_md_disks{device="md00",state="active"} 1 +node_md_disks{device="md00",state="down"} 0 node_md_disks{device="md00",state="failed"} 0 node_md_disks{device="md00",state="spare"} 0 node_md_disks{device="md10",state="active"} 2 +node_md_disks{device="md10",state="down"} 0 node_md_disks{device="md10",state="failed"} 0 node_md_disks{device="md10",state="spare"} 0 node_md_disks{device="md101",state="active"} 3 +node_md_disks{device="md101",state="down"} 0 node_md_disks{device="md101",state="failed"} 0 node_md_disks{device="md101",state="spare"} 0 node_md_disks{device="md11",state="active"} 2 +node_md_disks{device="md11",state="down"} 0 node_md_disks{device="md11",state="failed"} 1 node_md_disks{device="md11",state="spare"} 2 node_md_disks{device="md12",state="active"} 2 +node_md_disks{device="md12",state="down"} 0 node_md_disks{device="md12",state="failed"} 0 node_md_disks{device="md12",state="spare"} 0 node_md_disks{device="md120",state="active"} 2 +node_md_disks{device="md120",state="down"} 0 node_md_disks{device="md120",state="failed"} 0 node_md_disks{device="md120",state="spare"} 0 node_md_disks{device="md126",state="active"} 2 +node_md_disks{device="md126",state="down"} 0 node_md_disks{device="md126",state="failed"} 0 node_md_disks{device="md126",state="spare"} 0 node_md_disks{device="md127",state="active"} 2 +node_md_disks{device="md127",state="down"} 0 node_md_disks{device="md127",state="failed"} 0 node_md_disks{device="md127",state="spare"} 0 node_md_disks{device="md201",state="active"} 2 +node_md_disks{device="md201",state="down"} 0 node_md_disks{device="md201",state="failed"} 0 node_md_disks{device="md201",state="spare"} 0 node_md_disks{device="md219",state="active"} 0 +node_md_disks{device="md219",state="down"} 0 node_md_disks{device="md219",state="failed"} 0 node_md_disks{device="md219",state="spare"} 3 node_md_disks{device="md3",state="active"} 8 +node_md_disks{device="md3",state="down"} 0 node_md_disks{device="md3",state="failed"} 0 node_md_disks{device="md3",state="spare"} 2 node_md_disks{device="md4",state="active"} 0 +node_md_disks{device="md4",state="down"} 0 node_md_disks{device="md4",state="failed"} 1 node_md_disks{device="md4",state="spare"} 1 node_md_disks{device="md6",state="active"} 1 +node_md_disks{device="md6",state="down"} 1 node_md_disks{device="md6",state="failed"} 1 node_md_disks{device="md6",state="spare"} 1 node_md_disks{device="md7",state="active"} 3 +node_md_disks{device="md7",state="down"} 1 node_md_disks{device="md7",state="failed"} 1 node_md_disks{device="md7",state="spare"} 0 node_md_disks{device="md8",state="active"} 2 +node_md_disks{device="md8",state="down"} 0 node_md_disks{device="md8",state="failed"} 0 node_md_disks{device="md8",state="spare"} 2 node_md_disks{device="md9",state="active"} 4 +node_md_disks{device="md9",state="down"} 0 node_md_disks{device="md9",state="failed"} 2 node_md_disks{device="md9",state="spare"} 1 # HELP node_md_disks_required Total number of disks of device. @@ -1740,6 +1795,25 @@ node_md_state{device="md9",state="check"} 0 node_md_state{device="md9",state="inactive"} 0 node_md_state{device="md9",state="recovering"} 0 node_md_state{device="md9",state="resync"} 1 +# HELP node_md_sync_minutes_remaining Estimated finishing time for current sync in minutes. +# TYPE node_md_sync_minutes_remaining gauge +node_md_sync_minutes_remaining{device="md0"} 0 +node_md_sync_minutes_remaining{device="md00"} 0 +node_md_sync_minutes_remaining{device="md10"} 0 +node_md_sync_minutes_remaining{device="md101"} 0 +node_md_sync_minutes_remaining{device="md11"} 0 +node_md_sync_minutes_remaining{device="md12"} 0 +node_md_sync_minutes_remaining{device="md120"} 0 +node_md_sync_minutes_remaining{device="md126"} 0 +node_md_sync_minutes_remaining{device="md127"} 0 +node_md_sync_minutes_remaining{device="md201"} 0.2 +node_md_sync_minutes_remaining{device="md219"} 0 +node_md_sync_minutes_remaining{device="md3"} 0 +node_md_sync_minutes_remaining{device="md4"} 0 +node_md_sync_minutes_remaining{device="md6"} 17 +node_md_sync_minutes_remaining{device="md7"} 0 +node_md_sync_minutes_remaining{device="md8"} 17 +node_md_sync_minutes_remaining{device="md9"} 0 # HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes. # TYPE node_memory_Active_anon_bytes gauge node_memory_Active_anon_bytes 2.068484096e+09 From 31796018766038f8cdecd8811571fda82fdb9279 Mon Sep 17 00:00:00 2001 From: Finomosec Date: Wed, 1 May 2024 12:01:10 +0200 Subject: [PATCH 04/11] fixed unit-test expected output Signed-off-by: Finomosec --- collector/fixtures/e2e-64k-page-output.txt | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 99c58aba..2e15e011 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1559,57 +1559,112 @@ node_md_blocks_synced{device="md6"} 1.6775552e+07 node_md_blocks_synced{device="md7"} 7.813735424e+09 node_md_blocks_synced{device="md8"} 1.6775552e+07 node_md_blocks_synced{device="md9"} 0 +# HELP node_md_blocks_synced_pct Percentage of blocks synced on device. +# TYPE node_md_blocks_synced_pct gauge +node_md_blocks_synced_pct{device="md0"} 0 +node_md_blocks_synced_pct{device="md00"} 0 +node_md_blocks_synced_pct{device="md10"} 0 +node_md_blocks_synced_pct{device="md101"} 0 +node_md_blocks_synced_pct{device="md11"} 0 +node_md_blocks_synced_pct{device="md12"} 0 +node_md_blocks_synced_pct{device="md120"} 0 +node_md_blocks_synced_pct{device="md126"} 0 +node_md_blocks_synced_pct{device="md127"} 0 +node_md_blocks_synced_pct{device="md201"} 5.7 +node_md_blocks_synced_pct{device="md219"} 0 +node_md_blocks_synced_pct{device="md3"} 0 +node_md_blocks_synced_pct{device="md4"} 0 +node_md_blocks_synced_pct{device="md6"} 8.5 +node_md_blocks_synced_pct{device="md7"} 0 +node_md_blocks_synced_pct{device="md8"} 8.5 +node_md_blocks_synced_pct{device="md9"} 0 +# HELP node_md_blocks_synced_speed current sync speed (in Kilobytes/sec) +# TYPE node_md_blocks_synced_speed gauge +node_md_blocks_synced_speed{device="md0"} 0 +node_md_blocks_synced_speed{device="md00"} 0 +node_md_blocks_synced_speed{device="md10"} 0 +node_md_blocks_synced_speed{device="md101"} 0 +node_md_blocks_synced_speed{device="md11"} 0 +node_md_blocks_synced_speed{device="md12"} 0 +node_md_blocks_synced_speed{device="md120"} 0 +node_md_blocks_synced_speed{device="md126"} 0 +node_md_blocks_synced_speed{device="md127"} 0 +node_md_blocks_synced_speed{device="md201"} 114176 +node_md_blocks_synced_speed{device="md219"} 0 +node_md_blocks_synced_speed{device="md3"} 0 +node_md_blocks_synced_speed{device="md4"} 0 +node_md_blocks_synced_speed{device="md6"} 259783 +node_md_blocks_synced_speed{device="md7"} 0 +node_md_blocks_synced_speed{device="md8"} 259783 +node_md_blocks_synced_speed{device="md9"} 0 # HELP node_md_disks Number of active/failed/spare disks of device. # TYPE node_md_disks gauge node_md_disks{device="md0",state="active"} 2 +node_md_disks{device="md0",state="down"} 0 node_md_disks{device="md0",state="failed"} 0 node_md_disks{device="md0",state="spare"} 0 node_md_disks{device="md00",state="active"} 1 +node_md_disks{device="md00",state="down"} 0 node_md_disks{device="md00",state="failed"} 0 node_md_disks{device="md00",state="spare"} 0 node_md_disks{device="md10",state="active"} 2 +node_md_disks{device="md10",state="down"} 0 node_md_disks{device="md10",state="failed"} 0 node_md_disks{device="md10",state="spare"} 0 node_md_disks{device="md101",state="active"} 3 +node_md_disks{device="md101",state="down"} 0 node_md_disks{device="md101",state="failed"} 0 node_md_disks{device="md101",state="spare"} 0 node_md_disks{device="md11",state="active"} 2 +node_md_disks{device="md11",state="down"} 0 node_md_disks{device="md11",state="failed"} 1 node_md_disks{device="md11",state="spare"} 2 node_md_disks{device="md12",state="active"} 2 +node_md_disks{device="md12",state="down"} 0 node_md_disks{device="md12",state="failed"} 0 node_md_disks{device="md12",state="spare"} 0 node_md_disks{device="md120",state="active"} 2 +node_md_disks{device="md120",state="down"} 0 node_md_disks{device="md120",state="failed"} 0 node_md_disks{device="md120",state="spare"} 0 node_md_disks{device="md126",state="active"} 2 +node_md_disks{device="md126",state="down"} 0 node_md_disks{device="md126",state="failed"} 0 node_md_disks{device="md126",state="spare"} 0 node_md_disks{device="md127",state="active"} 2 +node_md_disks{device="md127",state="down"} 0 node_md_disks{device="md127",state="failed"} 0 node_md_disks{device="md127",state="spare"} 0 node_md_disks{device="md201",state="active"} 2 +node_md_disks{device="md201",state="down"} 0 node_md_disks{device="md201",state="failed"} 0 node_md_disks{device="md201",state="spare"} 0 node_md_disks{device="md219",state="active"} 0 +node_md_disks{device="md219",state="down"} 0 node_md_disks{device="md219",state="failed"} 0 node_md_disks{device="md219",state="spare"} 3 node_md_disks{device="md3",state="active"} 8 +node_md_disks{device="md3",state="down"} 0 node_md_disks{device="md3",state="failed"} 0 node_md_disks{device="md3",state="spare"} 2 node_md_disks{device="md4",state="active"} 0 +node_md_disks{device="md4",state="down"} 0 node_md_disks{device="md4",state="failed"} 1 node_md_disks{device="md4",state="spare"} 1 node_md_disks{device="md6",state="active"} 1 +node_md_disks{device="md6",state="down"} 1 node_md_disks{device="md6",state="failed"} 1 node_md_disks{device="md6",state="spare"} 1 node_md_disks{device="md7",state="active"} 3 +node_md_disks{device="md7",state="down"} 1 node_md_disks{device="md7",state="failed"} 1 node_md_disks{device="md7",state="spare"} 0 node_md_disks{device="md8",state="active"} 2 +node_md_disks{device="md8",state="down"} 0 node_md_disks{device="md8",state="failed"} 0 node_md_disks{device="md8",state="spare"} 2 node_md_disks{device="md9",state="active"} 4 +node_md_disks{device="md9",state="down"} 0 node_md_disks{device="md9",state="failed"} 2 node_md_disks{device="md9",state="spare"} 1 # HELP node_md_disks_required Total number of disks of device. @@ -1718,6 +1773,25 @@ node_md_state{device="md9",state="check"} 0 node_md_state{device="md9",state="inactive"} 0 node_md_state{device="md9",state="recovering"} 0 node_md_state{device="md9",state="resync"} 1 +# HELP node_md_sync_minutes_remaining Estimated finishing time for current sync in minutes. +# TYPE node_md_sync_minutes_remaining gauge +node_md_sync_minutes_remaining{device="md0"} 0 +node_md_sync_minutes_remaining{device="md00"} 0 +node_md_sync_minutes_remaining{device="md10"} 0 +node_md_sync_minutes_remaining{device="md101"} 0 +node_md_sync_minutes_remaining{device="md11"} 0 +node_md_sync_minutes_remaining{device="md12"} 0 +node_md_sync_minutes_remaining{device="md120"} 0 +node_md_sync_minutes_remaining{device="md126"} 0 +node_md_sync_minutes_remaining{device="md127"} 0 +node_md_sync_minutes_remaining{device="md201"} 0.2 +node_md_sync_minutes_remaining{device="md219"} 0 +node_md_sync_minutes_remaining{device="md3"} 0 +node_md_sync_minutes_remaining{device="md4"} 0 +node_md_sync_minutes_remaining{device="md6"} 17 +node_md_sync_minutes_remaining{device="md7"} 0 +node_md_sync_minutes_remaining{device="md8"} 17 +node_md_sync_minutes_remaining{device="md9"} 0 # HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes. # TYPE node_memory_Active_anon_bytes gauge node_memory_Active_anon_bytes 2.068484096e+09 From f21e3b547eea84ecc19995e47a797c840e760a07 Mon Sep 17 00:00:00 2001 From: Frederic Date: Wed, 1 May 2024 18:44:45 +0200 Subject: [PATCH 05/11] Update mdadm_linux.go changed sync_minutes_remaining to sync_time_remaining (in seconds) Signed-off-by: Frederic --- collector/mdadm_linux.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index bcccd377..74d3fb5b 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -105,9 +105,9 @@ var ( []string{"device"}, nil, ) - syncMinutesRemainingDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, "md", "sync_minutes_remaining"), - "Estimated finishing time for current sync in minutes.", + syncTimeRemainingDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, "md", "sync_time_remaining"), + "Estimated finishing time for current sync in seconds.", []string{"device"}, nil, ) @@ -231,9 +231,9 @@ func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error { mdStat.Name, ) ch <- prometheus.MustNewConstMetric( - syncMinutesRemainingDesc, + syncTimeRemainingDesc, prometheus.GaugeValue, - float64(mdStat.BlocksSyncedFinishTime), + float64(mdStat.BlocksSyncedFinishTime * 60), mdStat.Name, ) ch <- prometheus.MustNewConstMetric( From dd0a449f187d3e5b912d923f0cb7128e6766326f Mon Sep 17 00:00:00 2001 From: Frederic Date: Wed, 1 May 2024 18:46:11 +0200 Subject: [PATCH 06/11] Update mdadm_linux.go fixed code formatting Signed-off-by: Frederic --- collector/mdadm_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index 74d3fb5b..d12024eb 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -233,7 +233,7 @@ func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error { ch <- prometheus.MustNewConstMetric( syncTimeRemainingDesc, prometheus.GaugeValue, - float64(mdStat.BlocksSyncedFinishTime * 60), + float64(mdStat.BlocksSyncedFinishTime*60), mdStat.Name, ) ch <- prometheus.MustNewConstMetric( From 70a889f272d8b3e5db1511fc642fa5804bf768e6 Mon Sep 17 00:00:00 2001 From: Finomosec Date: Wed, 1 May 2024 18:50:39 +0200 Subject: [PATCH 07/11] fixed unit-test expected output Signed-off-by: Finomosec --- collector/fixtures/e2e-64k-page-output.txt | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 2e15e011..5a1ec23d 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1773,25 +1773,25 @@ node_md_state{device="md9",state="check"} 0 node_md_state{device="md9",state="inactive"} 0 node_md_state{device="md9",state="recovering"} 0 node_md_state{device="md9",state="resync"} 1 -# HELP node_md_sync_minutes_remaining Estimated finishing time for current sync in minutes. -# TYPE node_md_sync_minutes_remaining gauge -node_md_sync_minutes_remaining{device="md0"} 0 -node_md_sync_minutes_remaining{device="md00"} 0 -node_md_sync_minutes_remaining{device="md10"} 0 -node_md_sync_minutes_remaining{device="md101"} 0 -node_md_sync_minutes_remaining{device="md11"} 0 -node_md_sync_minutes_remaining{device="md12"} 0 -node_md_sync_minutes_remaining{device="md120"} 0 -node_md_sync_minutes_remaining{device="md126"} 0 -node_md_sync_minutes_remaining{device="md127"} 0 -node_md_sync_minutes_remaining{device="md201"} 0.2 -node_md_sync_minutes_remaining{device="md219"} 0 -node_md_sync_minutes_remaining{device="md3"} 0 -node_md_sync_minutes_remaining{device="md4"} 0 -node_md_sync_minutes_remaining{device="md6"} 17 -node_md_sync_minutes_remaining{device="md7"} 0 -node_md_sync_minutes_remaining{device="md8"} 17 -node_md_sync_minutes_remaining{device="md9"} 0 +# HELP node_md_sync_time_remaining Estimated finishing time for current sync in seconds. +# TYPE node_md_sync_time_remaining gauge +node_md_sync_time_remaining{device="md0"} 0 +node_md_sync_time_remaining{device="md00"} 0 +node_md_sync_time_remaining{device="md10"} 0 +node_md_sync_time_remaining{device="md101"} 0 +node_md_sync_time_remaining{device="md11"} 0 +node_md_sync_time_remaining{device="md12"} 0 +node_md_sync_time_remaining{device="md120"} 0 +node_md_sync_time_remaining{device="md126"} 0 +node_md_sync_time_remaining{device="md127"} 0 +node_md_sync_time_remaining{device="md201"} 12 +node_md_sync_time_remaining{device="md219"} 0 +node_md_sync_time_remaining{device="md3"} 0 +node_md_sync_time_remaining{device="md4"} 0 +node_md_sync_time_remaining{device="md6"} 1020 +node_md_sync_time_remaining{device="md7"} 0 +node_md_sync_time_remaining{device="md8"} 1020 +node_md_sync_time_remaining{device="md9"} 0 # HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes. # TYPE node_memory_Active_anon_bytes gauge node_memory_Active_anon_bytes 2.068484096e+09 From 9b3de103d5ee80c55d4943e24b7059ee66b87de9 Mon Sep 17 00:00:00 2001 From: Finomosec Date: Wed, 1 May 2024 19:21:23 +0200 Subject: [PATCH 08/11] fixed unit-test expected output Signed-off-by: Finomosec --- collector/fixtures/e2e-output.txt | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index c2ece281..1b1aeb68 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1795,25 +1795,25 @@ node_md_state{device="md9",state="check"} 0 node_md_state{device="md9",state="inactive"} 0 node_md_state{device="md9",state="recovering"} 0 node_md_state{device="md9",state="resync"} 1 -# HELP node_md_sync_minutes_remaining Estimated finishing time for current sync in minutes. -# TYPE node_md_sync_minutes_remaining gauge -node_md_sync_minutes_remaining{device="md0"} 0 -node_md_sync_minutes_remaining{device="md00"} 0 -node_md_sync_minutes_remaining{device="md10"} 0 -node_md_sync_minutes_remaining{device="md101"} 0 -node_md_sync_minutes_remaining{device="md11"} 0 -node_md_sync_minutes_remaining{device="md12"} 0 -node_md_sync_minutes_remaining{device="md120"} 0 -node_md_sync_minutes_remaining{device="md126"} 0 -node_md_sync_minutes_remaining{device="md127"} 0 -node_md_sync_minutes_remaining{device="md201"} 0.2 -node_md_sync_minutes_remaining{device="md219"} 0 -node_md_sync_minutes_remaining{device="md3"} 0 -node_md_sync_minutes_remaining{device="md4"} 0 -node_md_sync_minutes_remaining{device="md6"} 17 -node_md_sync_minutes_remaining{device="md7"} 0 -node_md_sync_minutes_remaining{device="md8"} 17 -node_md_sync_minutes_remaining{device="md9"} 0 +# HELP node_md_sync_time_remaining Estimated finishing time for current sync in seconds. +# TYPE node_md_sync_time_remaining gauge +node_md_sync_time_remaining{device="md0"} 0 +node_md_sync_time_remaining{device="md00"} 0 +node_md_sync_time_remaining{device="md10"} 0 +node_md_sync_time_remaining{device="md101"} 0 +node_md_sync_time_remaining{device="md11"} 0 +node_md_sync_time_remaining{device="md12"} 0 +node_md_sync_time_remaining{device="md120"} 0 +node_md_sync_time_remaining{device="md126"} 0 +node_md_sync_time_remaining{device="md127"} 0 +node_md_sync_time_remaining{device="md201"} 12 +node_md_sync_time_remaining{device="md219"} 0 +node_md_sync_time_remaining{device="md3"} 0 +node_md_sync_time_remaining{device="md4"} 0 +node_md_sync_time_remaining{device="md6"} 1020 +node_md_sync_time_remaining{device="md7"} 0 +node_md_sync_time_remaining{device="md8"} 1020 +node_md_sync_time_remaining{device="md9"} 0 # HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes. # TYPE node_memory_Active_anon_bytes gauge node_memory_Active_anon_bytes 2.068484096e+09 From 4d743c485f1cfe1ff91217f0115f97750dffdb3e Mon Sep 17 00:00:00 2001 From: Frederic Date: Thu, 9 May 2024 11:23:50 +0200 Subject: [PATCH 09/11] Update collector/mdadm_linux.go renamed pct to percent Co-authored-by: Ben Kochie Signed-off-by: Frederic --- collector/mdadm_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index d12024eb..3a2bf802 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -100,7 +100,7 @@ var ( nil, ) blocksSyncedPctDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, "md", "blocks_synced_pct"), + prometheus.BuildFQName(namespace, "md", "blocks_synced_percent"), "Percentage of blocks synced on device.", []string{"device"}, nil, From 6df22223dfc77bf6ff06a844b016d9aa56e93895 Mon Sep 17 00:00:00 2001 From: Frederic Date: Thu, 9 May 2024 11:24:04 +0200 Subject: [PATCH 10/11] Update collector/mdadm_linux.go added unit "seconds" Co-authored-by: Ben Kochie Signed-off-by: Frederic --- collector/mdadm_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/mdadm_linux.go b/collector/mdadm_linux.go index 3a2bf802..032d417e 100644 --- a/collector/mdadm_linux.go +++ b/collector/mdadm_linux.go @@ -106,7 +106,7 @@ var ( nil, ) syncTimeRemainingDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, "md", "sync_time_remaining"), + prometheus.BuildFQName(namespace, "md", "sync_time_remaining_seconds"), "Estimated finishing time for current sync in seconds.", []string{"device"}, nil, From cf0dffe8dce4985132440290d3278373f70f8493 Mon Sep 17 00:00:00 2001 From: Finomosec Date: Thu, 9 May 2024 11:33:39 +0200 Subject: [PATCH 11/11] fixed unit-test expected output Signed-off-by: Finomosec --- collector/fixtures/e2e-64k-page-output.txt | 76 +++++++++++----------- collector/fixtures/e2e-output.txt | 76 +++++++++++----------- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 5a1ec23d..44ed9f79 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1559,25 +1559,25 @@ node_md_blocks_synced{device="md6"} 1.6775552e+07 node_md_blocks_synced{device="md7"} 7.813735424e+09 node_md_blocks_synced{device="md8"} 1.6775552e+07 node_md_blocks_synced{device="md9"} 0 -# HELP node_md_blocks_synced_pct Percentage of blocks synced on device. -# TYPE node_md_blocks_synced_pct gauge -node_md_blocks_synced_pct{device="md0"} 0 -node_md_blocks_synced_pct{device="md00"} 0 -node_md_blocks_synced_pct{device="md10"} 0 -node_md_blocks_synced_pct{device="md101"} 0 -node_md_blocks_synced_pct{device="md11"} 0 -node_md_blocks_synced_pct{device="md12"} 0 -node_md_blocks_synced_pct{device="md120"} 0 -node_md_blocks_synced_pct{device="md126"} 0 -node_md_blocks_synced_pct{device="md127"} 0 -node_md_blocks_synced_pct{device="md201"} 5.7 -node_md_blocks_synced_pct{device="md219"} 0 -node_md_blocks_synced_pct{device="md3"} 0 -node_md_blocks_synced_pct{device="md4"} 0 -node_md_blocks_synced_pct{device="md6"} 8.5 -node_md_blocks_synced_pct{device="md7"} 0 -node_md_blocks_synced_pct{device="md8"} 8.5 -node_md_blocks_synced_pct{device="md9"} 0 +# HELP node_md_blocks_synced_percent Percentage of blocks synced on device. +# TYPE node_md_blocks_synced_percent gauge +node_md_blocks_synced_percent{device="md0"} 0 +node_md_blocks_synced_percent{device="md00"} 0 +node_md_blocks_synced_percent{device="md10"} 0 +node_md_blocks_synced_percent{device="md101"} 0 +node_md_blocks_synced_percent{device="md11"} 0 +node_md_blocks_synced_percent{device="md12"} 0 +node_md_blocks_synced_percent{device="md120"} 0 +node_md_blocks_synced_percent{device="md126"} 0 +node_md_blocks_synced_percent{device="md127"} 0 +node_md_blocks_synced_percent{device="md201"} 5.7 +node_md_blocks_synced_percent{device="md219"} 0 +node_md_blocks_synced_percent{device="md3"} 0 +node_md_blocks_synced_percent{device="md4"} 0 +node_md_blocks_synced_percent{device="md6"} 8.5 +node_md_blocks_synced_percent{device="md7"} 0 +node_md_blocks_synced_percent{device="md8"} 8.5 +node_md_blocks_synced_percent{device="md9"} 0 # HELP node_md_blocks_synced_speed current sync speed (in Kilobytes/sec) # TYPE node_md_blocks_synced_speed gauge node_md_blocks_synced_speed{device="md0"} 0 @@ -1773,25 +1773,25 @@ node_md_state{device="md9",state="check"} 0 node_md_state{device="md9",state="inactive"} 0 node_md_state{device="md9",state="recovering"} 0 node_md_state{device="md9",state="resync"} 1 -# HELP node_md_sync_time_remaining Estimated finishing time for current sync in seconds. -# TYPE node_md_sync_time_remaining gauge -node_md_sync_time_remaining{device="md0"} 0 -node_md_sync_time_remaining{device="md00"} 0 -node_md_sync_time_remaining{device="md10"} 0 -node_md_sync_time_remaining{device="md101"} 0 -node_md_sync_time_remaining{device="md11"} 0 -node_md_sync_time_remaining{device="md12"} 0 -node_md_sync_time_remaining{device="md120"} 0 -node_md_sync_time_remaining{device="md126"} 0 -node_md_sync_time_remaining{device="md127"} 0 -node_md_sync_time_remaining{device="md201"} 12 -node_md_sync_time_remaining{device="md219"} 0 -node_md_sync_time_remaining{device="md3"} 0 -node_md_sync_time_remaining{device="md4"} 0 -node_md_sync_time_remaining{device="md6"} 1020 -node_md_sync_time_remaining{device="md7"} 0 -node_md_sync_time_remaining{device="md8"} 1020 -node_md_sync_time_remaining{device="md9"} 0 +# HELP node_md_sync_time_remaining_seconds Estimated finishing time for current sync in seconds. +# TYPE node_md_sync_time_remaining_seconds gauge +node_md_sync_time_remaining_seconds{device="md0"} 0 +node_md_sync_time_remaining_seconds{device="md00"} 0 +node_md_sync_time_remaining_seconds{device="md10"} 0 +node_md_sync_time_remaining_seconds{device="md101"} 0 +node_md_sync_time_remaining_seconds{device="md11"} 0 +node_md_sync_time_remaining_seconds{device="md12"} 0 +node_md_sync_time_remaining_seconds{device="md120"} 0 +node_md_sync_time_remaining_seconds{device="md126"} 0 +node_md_sync_time_remaining_seconds{device="md127"} 0 +node_md_sync_time_remaining_seconds{device="md201"} 12 +node_md_sync_time_remaining_seconds{device="md219"} 0 +node_md_sync_time_remaining_seconds{device="md3"} 0 +node_md_sync_time_remaining_seconds{device="md4"} 0 +node_md_sync_time_remaining_seconds{device="md6"} 1020 +node_md_sync_time_remaining_seconds{device="md7"} 0 +node_md_sync_time_remaining_seconds{device="md8"} 1020 +node_md_sync_time_remaining_seconds{device="md9"} 0 # HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes. # TYPE node_memory_Active_anon_bytes gauge node_memory_Active_anon_bytes 2.068484096e+09 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 1b1aeb68..a1741243 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1581,25 +1581,25 @@ node_md_blocks_synced{device="md6"} 1.6775552e+07 node_md_blocks_synced{device="md7"} 7.813735424e+09 node_md_blocks_synced{device="md8"} 1.6775552e+07 node_md_blocks_synced{device="md9"} 0 -# HELP node_md_blocks_synced_pct Percentage of blocks synced on device. -# TYPE node_md_blocks_synced_pct gauge -node_md_blocks_synced_pct{device="md0"} 0 -node_md_blocks_synced_pct{device="md00"} 0 -node_md_blocks_synced_pct{device="md10"} 0 -node_md_blocks_synced_pct{device="md101"} 0 -node_md_blocks_synced_pct{device="md11"} 0 -node_md_blocks_synced_pct{device="md12"} 0 -node_md_blocks_synced_pct{device="md120"} 0 -node_md_blocks_synced_pct{device="md126"} 0 -node_md_blocks_synced_pct{device="md127"} 0 -node_md_blocks_synced_pct{device="md201"} 5.7 -node_md_blocks_synced_pct{device="md219"} 0 -node_md_blocks_synced_pct{device="md3"} 0 -node_md_blocks_synced_pct{device="md4"} 0 -node_md_blocks_synced_pct{device="md6"} 8.5 -node_md_blocks_synced_pct{device="md7"} 0 -node_md_blocks_synced_pct{device="md8"} 8.5 -node_md_blocks_synced_pct{device="md9"} 0 +# HELP node_md_blocks_synced_percent Percentage of blocks synced on device. +# TYPE node_md_blocks_synced_percent gauge +node_md_blocks_synced_percent{device="md0"} 0 +node_md_blocks_synced_percent{device="md00"} 0 +node_md_blocks_synced_percent{device="md10"} 0 +node_md_blocks_synced_percent{device="md101"} 0 +node_md_blocks_synced_percent{device="md11"} 0 +node_md_blocks_synced_percent{device="md12"} 0 +node_md_blocks_synced_percent{device="md120"} 0 +node_md_blocks_synced_percent{device="md126"} 0 +node_md_blocks_synced_percent{device="md127"} 0 +node_md_blocks_synced_percent{device="md201"} 5.7 +node_md_blocks_synced_percent{device="md219"} 0 +node_md_blocks_synced_percent{device="md3"} 0 +node_md_blocks_synced_percent{device="md4"} 0 +node_md_blocks_synced_percent{device="md6"} 8.5 +node_md_blocks_synced_percent{device="md7"} 0 +node_md_blocks_synced_percent{device="md8"} 8.5 +node_md_blocks_synced_percent{device="md9"} 0 # HELP node_md_blocks_synced_speed current sync speed (in Kilobytes/sec) # TYPE node_md_blocks_synced_speed gauge node_md_blocks_synced_speed{device="md0"} 0 @@ -1795,25 +1795,25 @@ node_md_state{device="md9",state="check"} 0 node_md_state{device="md9",state="inactive"} 0 node_md_state{device="md9",state="recovering"} 0 node_md_state{device="md9",state="resync"} 1 -# HELP node_md_sync_time_remaining Estimated finishing time for current sync in seconds. -# TYPE node_md_sync_time_remaining gauge -node_md_sync_time_remaining{device="md0"} 0 -node_md_sync_time_remaining{device="md00"} 0 -node_md_sync_time_remaining{device="md10"} 0 -node_md_sync_time_remaining{device="md101"} 0 -node_md_sync_time_remaining{device="md11"} 0 -node_md_sync_time_remaining{device="md12"} 0 -node_md_sync_time_remaining{device="md120"} 0 -node_md_sync_time_remaining{device="md126"} 0 -node_md_sync_time_remaining{device="md127"} 0 -node_md_sync_time_remaining{device="md201"} 12 -node_md_sync_time_remaining{device="md219"} 0 -node_md_sync_time_remaining{device="md3"} 0 -node_md_sync_time_remaining{device="md4"} 0 -node_md_sync_time_remaining{device="md6"} 1020 -node_md_sync_time_remaining{device="md7"} 0 -node_md_sync_time_remaining{device="md8"} 1020 -node_md_sync_time_remaining{device="md9"} 0 +# HELP node_md_sync_time_remaining_seconds Estimated finishing time for current sync in seconds. +# TYPE node_md_sync_time_remaining_seconds gauge +node_md_sync_time_remaining_seconds{device="md0"} 0 +node_md_sync_time_remaining_seconds{device="md00"} 0 +node_md_sync_time_remaining_seconds{device="md10"} 0 +node_md_sync_time_remaining_seconds{device="md101"} 0 +node_md_sync_time_remaining_seconds{device="md11"} 0 +node_md_sync_time_remaining_seconds{device="md12"} 0 +node_md_sync_time_remaining_seconds{device="md120"} 0 +node_md_sync_time_remaining_seconds{device="md126"} 0 +node_md_sync_time_remaining_seconds{device="md127"} 0 +node_md_sync_time_remaining_seconds{device="md201"} 12 +node_md_sync_time_remaining_seconds{device="md219"} 0 +node_md_sync_time_remaining_seconds{device="md3"} 0 +node_md_sync_time_remaining_seconds{device="md4"} 0 +node_md_sync_time_remaining_seconds{device="md6"} 1020 +node_md_sync_time_remaining_seconds{device="md7"} 0 +node_md_sync_time_remaining_seconds{device="md8"} 1020 +node_md_sync_time_remaining_seconds{device="md9"} 0 # HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes. # TYPE node_memory_Active_anon_bytes gauge node_memory_Active_anon_bytes 2.068484096e+09