From c01b5fb37e16bace256fbd05cf669aba88d36c7a Mon Sep 17 00:00:00 2001 From: Joshua Baergen Date: Fri, 15 Dec 2023 15:50:21 -0700 Subject: [PATCH] monitors: Remove stats that have been dead since Luminous Ceph commit reference e170405fd873723bec6ce691afad82641bab2ef1 --- ceph/monitors.go | 214 ------------------------------------------ ceph/monitors_test.go | 180 ----------------------------------- 2 files changed, 394 deletions(-) diff --git a/ceph/monitors.go b/ceph/monitors.go index ab2eb57..b56ede5 100644 --- a/ceph/monitors.go +++ b/ceph/monitors.go @@ -37,23 +37,6 @@ type MonitorCollector struct { conn Conn logger *logrus.Logger - // TotalKBs display the total storage a given monitor node has. - TotalKBs *prometheus.GaugeVec - - // UsedKBs depict how much of the total storage our monitor process - // has utilized. - UsedKBs *prometheus.GaugeVec - - // AvailKBs shows the space left unused. - AvailKBs *prometheus.GaugeVec - - // PercentAvail shows the amount of unused space as a percentage of total - // space. - PercentAvail *prometheus.GaugeVec - - // Store exposes information about internal backing store. - Store Store - // ClockSkew shows how far the monitor clocks have skewed from each other. This // is an important metric because the functioning of Ceph's paxos depends on // the clocks being aligned as close to each other as possible. @@ -73,23 +56,6 @@ type MonitorCollector struct { CephFeatures *prometheus.GaugeVec } -// Store displays information about Monitor's FileStore. It is responsible for -// storing all the meta information about the cluster, including monmaps, osdmaps, -// pgmaps, etc. along with logs and other data. -type Store struct { - // TotalBytes displays the current size of the FileStore. - TotalBytes *prometheus.GaugeVec - - // SSTBytes shows the amount used by LevelDB's sorted-string tables. - SSTBytes *prometheus.GaugeVec - - // LogBytes shows the amount used by logs. - LogBytes *prometheus.GaugeVec - - // MiscBytes shows the amount used by miscellaneous information. - MiscBytes *prometheus.GaugeVec -} - // NewMonitorCollector creates an instance of the MonitorCollector and instantiates // the individual metrics that show information about the monitor processes. func NewMonitorCollector(exporter *Exporter) *MonitorCollector { @@ -100,80 +66,6 @@ func NewMonitorCollector(exporter *Exporter) *MonitorCollector { conn: exporter.Conn, logger: exporter.Logger, - TotalKBs: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_capacity_bytes", - Help: "Total storage capacity of the monitor node", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - UsedKBs: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_used_bytes", - Help: "Storage of the monitor node that is currently allocated for use", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - AvailKBs: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_avail_bytes", - Help: "Total unused storage capacity that the monitor node has left", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - PercentAvail: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_avail_percent", - Help: "Percentage of total unused storage capacity that the monitor node has left", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - Store: Store{ - TotalBytes: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_store_capacity_bytes", - Help: "Total capacity of the FileStore backing the monitor daemon", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - SSTBytes: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_store_sst_bytes", - Help: "Capacity of the FileStore used only for raw SSTs", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - LogBytes: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_store_log_bytes", - Help: "Capacity of the FileStore used only for logging", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - MiscBytes: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cephNamespace, - Name: "monitor_store_misc_bytes", - Help: "Capacity of the FileStore used only for storing miscellaneous information", - ConstLabels: labels, - }, - []string{"monitor"}, - ), - }, ClockSkew: prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: cephNamespace, @@ -223,16 +115,6 @@ func NewMonitorCollector(exporter *Exporter) *MonitorCollector { func (m *MonitorCollector) collectorList() []prometheus.Collector { return []prometheus.Collector{ - m.TotalKBs, - m.UsedKBs, - m.AvailKBs, - m.PercentAvail, - - m.Store.TotalBytes, - m.Store.SSTBytes, - m.Store.LogBytes, - m.Store.MiscBytes, - m.ClockSkew, m.Latency, m.CephVersions, @@ -255,32 +137,6 @@ type cephTimeSyncStatus struct { } type cephMonitorStats struct { - Health struct { - Health struct { - HealthServices []struct { - Mons []struct { - Name string `json:"name"` - KBTotal json.Number `json:"kb_total"` - KBUsed json.Number `json:"kb_used"` - KBAvail json.Number `json:"kb_avail"` - AvailPercent json.Number `json:"avail_percent"` - StoreStats struct { - BytesTotal json.Number `json:"bytes_total"` - BytesSST json.Number `json:"bytes_sst"` - BytesLog json.Number `json:"bytes_log"` - BytesMisc json.Number `json:"bytes_misc"` - } `json:"store_stats"` - } `json:"mons"` - } `json:"health_services"` - } `json:"health"` - TimeChecks struct { - Mons []struct { - Name string `json:"name"` - Skew json.Number `json:"skew"` - Latency json.Number `json:"latency"` - } `json:"mons"` - } `json:"timechecks"` - } `json:"health"` Quorum []int `json:"quorum"` } @@ -397,81 +253,11 @@ func (m *MonitorCollector) collect() error { } // Reset daemon specifc metrics; daemons can leave the cluster - m.TotalKBs.Reset() - m.UsedKBs.Reset() - m.AvailKBs.Reset() - m.PercentAvail.Reset() m.Latency.Reset() m.ClockSkew.Reset() m.CephVersions.Reset() m.CephFeatures.Reset() - for _, healthService := range stats.Health.Health.HealthServices { - for _, monstat := range healthService.Mons { - kbTotal, err := monstat.KBTotal.Float64() - if err != nil { - return err - } - m.TotalKBs.WithLabelValues(monstat.Name).Set(kbTotal * 1024) - - kbUsed, err := monstat.KBUsed.Float64() - if err != nil { - return err - } - m.UsedKBs.WithLabelValues(monstat.Name).Set(kbUsed * 1024) - - kbAvail, err := monstat.KBAvail.Float64() - if err != nil { - return err - } - m.AvailKBs.WithLabelValues(monstat.Name).Set(kbAvail * 1024) - - percentAvail, err := monstat.AvailPercent.Float64() - if err != nil { - return err - } - m.PercentAvail.WithLabelValues(monstat.Name).Set(percentAvail) - - storeBytes, err := monstat.StoreStats.BytesTotal.Float64() - if err != nil { - return err - } - m.Store.TotalBytes.WithLabelValues(monstat.Name).Set(storeBytes) - - sstBytes, err := monstat.StoreStats.BytesSST.Float64() - if err != nil { - return err - } - m.Store.SSTBytes.WithLabelValues(monstat.Name).Set(sstBytes) - - logBytes, err := monstat.StoreStats.BytesLog.Float64() - if err != nil { - return err - } - m.Store.LogBytes.WithLabelValues(monstat.Name).Set(logBytes) - - miscBytes, err := monstat.StoreStats.BytesMisc.Float64() - if err != nil { - return err - } - m.Store.MiscBytes.WithLabelValues(monstat.Name).Set(miscBytes) - } - } - - for _, monstat := range stats.Health.TimeChecks.Mons { - skew, err := monstat.Skew.Float64() - if err != nil { - return err - } - m.ClockSkew.WithLabelValues(monstat.Name).Set(skew) - - latency, err := monstat.Latency.Float64() - if err != nil { - return err - } - m.Latency.WithLabelValues(monstat.Name).Set(latency) - } - for monNode, tstat := range timeStats.TimeChecks { skew, err := tstat.Skew.Float64() if err != nil { diff --git a/ceph/monitors_test.go b/ceph/monitors_test.go index 2d52409..0ea2e65 100644 --- a/ceph/monitors_test.go +++ b/ceph/monitors_test.go @@ -37,136 +37,6 @@ func TestMonitorCollector(t *testing.T) { { input: ` { - "health": { - "health": { - "health_services": [ - { - "mons": [ - { - "name": "test-mon01", - "kb_total": 412718256, - "kb_used": 1812852, - "kb_avail": 389917500, - "avail_percent": 94, - "last_updated": "2015-12-28 15:54:03.763348", - "store_stats": { - "bytes_total": 1781282079, - "bytes_sst": 1, - "bytes_log": 609694, - "bytes_misc": 1780672385, - "last_updated": "0.000000" - }, - "health": "HEALTH_OK" - }, - { - "name": "test-mon02", - "kb_total": 412718256, - "kb_used": 1875304, - "kb_avail": 389855048, - "avail_percent": 94, - "last_updated": "2015-12-28 15:53:53.808657", - "store_stats": { - "bytes_total": 1844348214, - "bytes_sst": 2, - "bytes_log": 871605, - "bytes_misc": 1843476609, - "last_updated": "0.000000" - }, - "health": "HEALTH_OK" - }, - { - "name": "test-mon03", - "kb_total": 412718256, - "kb_used": 2095356, - "kb_avail": 389634996, - "avail_percent": 94, - "last_updated": "2015-12-28 15:53:06.292749", - "store_stats": { - "bytes_total": 2069468587, - "bytes_sst": 3, - "bytes_log": 871605, - "bytes_misc": 2068596982, - "last_updated": "0.000000" - }, - "health": "HEALTH_OK" - }, - { - "name": "test-mon04", - "kb_total": 412718256, - "kb_used": 1726276, - "kb_avail": 390004076, - "avail_percent": 94, - "last_updated": "2015-12-28 15:53:10.770775", - "store_stats": { - "bytes_total": 1691972147, - "bytes_sst": 4, - "bytes_log": 871605, - "bytes_misc": 1691100542, - "last_updated": "0.000000" - }, - "health": "HEALTH_OK" - }, - { - "name": "test-mon05", - "kb_total": 412718256, - "kb_used": 1883228, - "kb_avail": 389847124, - "avail_percent": 94, - "last_updated": "2015-12-28 15:53:11.407033", - "store_stats": { - "bytes_total": 1852485942, - "bytes_sst": 5, - "bytes_log": 871605, - "bytes_misc": 1851614337, - "last_updated": "0.000000" - }, - "health": "HEALTH_OK" - } - ] - } - ] - }, - "timechecks": { - "epoch": 70, - "round": 3362, - "round_status": "finished", - "mons": [ - { - "name": "test-mon01", - "skew": 0.000000, - "latency": 0.000000, - "health": "HEALTH_OK" - }, - { - "name": "test-mon02", - "skew": -0.000002, - "latency": 0.000815, - "health": "HEALTH_OK" - }, - { - "name": "test-mon03", - "skew": -0.000002, - "latency": 0.000829, - "health": "HEALTH_OK" - }, - { - "name": "test-mon04", - "skew": -0.000019, - "latency": 0.000609, - "health": "HEALTH_OK" - }, - { - "name": "test-mon05", - "skew": -0.000628, - "latency": 0.000659, - "health": "HEALTH_OK" - } - ] - }, - "summary": [], - "overall_status": "HEALTH_OK", - "detail": [] - }, "fsid": "6C9BF03E-044E-4EEB-9C5F-145A54ECF7DB", "election_epoch": 70, "quorum": [ @@ -213,57 +83,7 @@ func TestMonitorCollector(t *testing.T) { `, version: `{"version":"ceph version 16.2.11-22-wasd (1984a8c33225d70559cdf27dbab81e3ce153f6ac) pacific (stable)"}`, regexes: []*regexp.Regexp{ - regexp.MustCompile(`ceph_monitor_avail_bytes{cluster="ceph",monitor="test-mon01"} 3.9927552e`), - regexp.MustCompile(`ceph_monitor_avail_bytes{cluster="ceph",monitor="test-mon02"} 3.99211569152e`), - regexp.MustCompile(`ceph_monitor_avail_bytes{cluster="ceph",monitor="test-mon03"} 3.98986235904e`), - regexp.MustCompile(`ceph_monitor_avail_bytes{cluster="ceph",monitor="test-mon04"} 3.99364173824`), - regexp.MustCompile(`ceph_monitor_avail_bytes{cluster="ceph",monitor="test-mon05"} 3.99203454976e`), - regexp.MustCompile(`ceph_monitor_avail_percent{cluster="ceph",monitor="test-mon01"} 94`), - regexp.MustCompile(`ceph_monitor_avail_percent{cluster="ceph",monitor="test-mon02"} 94`), - regexp.MustCompile(`ceph_monitor_avail_percent{cluster="ceph",monitor="test-mon03"} 94`), - regexp.MustCompile(`ceph_monitor_avail_percent{cluster="ceph",monitor="test-mon04"} 94`), - regexp.MustCompile(`ceph_monitor_avail_percent{cluster="ceph",monitor="test-mon05"} 94`), - regexp.MustCompile(`ceph_monitor_clock_skew_seconds{cluster="ceph",monitor="test-mon01"} 0`), - regexp.MustCompile(`ceph_monitor_clock_skew_seconds{cluster="ceph",monitor="test-mon02"} -2e-06`), - regexp.MustCompile(`ceph_monitor_clock_skew_seconds{cluster="ceph",monitor="test-mon03"} -2e-06`), - regexp.MustCompile(`ceph_monitor_clock_skew_seconds{cluster="ceph",monitor="test-mon04"} -1.9e-05`), - regexp.MustCompile(`ceph_monitor_clock_skew_seconds{cluster="ceph",monitor="test-mon05"} -0.000628`), - regexp.MustCompile(`ceph_monitor_latency_seconds{cluster="ceph",monitor="test-mon01"} 0`), - regexp.MustCompile(`ceph_monitor_latency_seconds{cluster="ceph",monitor="test-mon02"} 0.000815`), - regexp.MustCompile(`ceph_monitor_latency_seconds{cluster="ceph",monitor="test-mon03"} 0.000829`), - regexp.MustCompile(`ceph_monitor_latency_seconds{cluster="ceph",monitor="test-mon04"} 0.000609`), - regexp.MustCompile(`ceph_monitor_latency_seconds{cluster="ceph",monitor="test-mon05"} 0.000659`), regexp.MustCompile(`ceph_monitor_quorum_count{cluster="ceph"} 5`), - regexp.MustCompile(`ceph_monitor_store_log_bytes{cluster="ceph",monitor="test-mon01"} 609694`), - regexp.MustCompile(`ceph_monitor_store_log_bytes{cluster="ceph",monitor="test-mon02"} 871605`), - regexp.MustCompile(`ceph_monitor_store_log_bytes{cluster="ceph",monitor="test-mon03"} 871605`), - regexp.MustCompile(`ceph_monitor_store_log_bytes{cluster="ceph",monitor="test-mon04"} 871605`), - regexp.MustCompile(`ceph_monitor_store_log_bytes{cluster="ceph",monitor="test-mon05"} 871605`), - regexp.MustCompile(`ceph_monitor_store_misc_bytes{cluster="ceph",monitor="test-mon01"} 1.780672385e`), - regexp.MustCompile(`ceph_monitor_store_misc_bytes{cluster="ceph",monitor="test-mon02"} 1.843476609e`), - regexp.MustCompile(`ceph_monitor_store_misc_bytes{cluster="ceph",monitor="test-mon03"} 2.068596982e`), - regexp.MustCompile(`ceph_monitor_store_misc_bytes{cluster="ceph",monitor="test-mon04"} 1.691100542e`), - regexp.MustCompile(`ceph_monitor_store_misc_bytes{cluster="ceph",monitor="test-mon05"} 1.851614337e`), - regexp.MustCompile(`ceph_monitor_store_sst_bytes{cluster="ceph",monitor="test-mon01"} 1`), - regexp.MustCompile(`ceph_monitor_store_sst_bytes{cluster="ceph",monitor="test-mon02"} 2`), - regexp.MustCompile(`ceph_monitor_store_sst_bytes{cluster="ceph",monitor="test-mon03"} 3`), - regexp.MustCompile(`ceph_monitor_store_sst_bytes{cluster="ceph",monitor="test-mon04"} 4`), - regexp.MustCompile(`ceph_monitor_store_sst_bytes{cluster="ceph",monitor="test-mon05"} 5`), - regexp.MustCompile(`ceph_monitor_store_capacity_bytes{cluster="ceph",monitor="test-mon01"} 1.781282079e`), - regexp.MustCompile(`ceph_monitor_store_capacity_bytes{cluster="ceph",monitor="test-mon02"} 1.844348214e`), - regexp.MustCompile(`ceph_monitor_store_capacity_bytes{cluster="ceph",monitor="test-mon03"} 2.069468587e`), - regexp.MustCompile(`ceph_monitor_store_capacity_bytes{cluster="ceph",monitor="test-mon04"} 1.691972147e`), - regexp.MustCompile(`ceph_monitor_store_capacity_bytes{cluster="ceph",monitor="test-mon05"} 1.852485942e`), - regexp.MustCompile(`ceph_monitor_capacity_bytes{cluster="ceph",monitor="test-mon01"} 4.22623494144e`), - regexp.MustCompile(`ceph_monitor_capacity_bytes{cluster="ceph",monitor="test-mon02"} 4.22623494144e`), - regexp.MustCompile(`ceph_monitor_capacity_bytes{cluster="ceph",monitor="test-mon03"} 4.22623494144e`), - regexp.MustCompile(`ceph_monitor_capacity_bytes{cluster="ceph",monitor="test-mon04"} 4.22623494144e`), - regexp.MustCompile(`ceph_monitor_capacity_bytes{cluster="ceph",monitor="test-mon05"} 4.22623494144e`), - regexp.MustCompile(`ceph_monitor_used_bytes{cluster="ceph",monitor="test-mon01"} 1.856360448e`), - regexp.MustCompile(`ceph_monitor_used_bytes{cluster="ceph",monitor="test-mon02"} 1.920311296e`), - regexp.MustCompile(`ceph_monitor_used_bytes{cluster="ceph",monitor="test-mon03"} 2.145644544e`), - regexp.MustCompile(`ceph_monitor_used_bytes{cluster="ceph",monitor="test-mon04"} 1.767706624e`), - regexp.MustCompile(`ceph_monitor_used_bytes{cluster="ceph",monitor="test-mon05"} 1.928425472e`), }, }, } {