Skip to content

Commit

Permalink
Merge pull request #215 from digitalocean/fix-pacific-mgrs
Browse files Browse the repository at this point in the history
ceph: Support the Octopus+ mgrmap format; improve multi-version testing.
  • Loading branch information
baergj authored Apr 12, 2022
2 parents e54e159 + ebd166b commit 43df70b
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 131 deletions.
20 changes: 17 additions & 3 deletions ceph/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,11 @@ type cephHealthStats struct {
} `json:"pgs_by_state"`
} `json:"pgmap"`
MgrMap struct {
// Octopus+ fields
Available bool `json:"available"`
NumStandBys int `json:"num_standbys"`

// Nautilus fields
ActiveName string `json:"active_name"`
StandBys []struct {
Name string `json:"name"`
Expand Down Expand Up @@ -1382,12 +1387,21 @@ func (c *ClusterHealthCollector) collect(ch chan<- prometheus.Metric) error {
c.MisplacedRatio.Set(stats.PGMap.MisplacedRatio)

activeMgr := 0
if len(stats.MgrMap.ActiveName) > 0 {
activeMgr = 1
standByMgrs := 0
if c.version.IsAtLeast(Octopus) {
if stats.MgrMap.Available {
activeMgr = 1
}
standByMgrs = stats.MgrMap.NumStandBys
} else {
if len(stats.MgrMap.ActiveName) > 0 {
activeMgr = 1
}
standByMgrs = len(stats.MgrMap.StandBys)
}

c.MgrsActive.Set(float64(activeMgr))
c.MgrsNum.Set(float64(activeMgr + len(stats.MgrMap.StandBys)))
c.MgrsNum.Set(float64(activeMgr + standByMgrs))

for name, data := range stats.ServiceMap.Services.RbdMirror.Daemons {
if name == "summary" {
Expand Down
Loading

0 comments on commit 43df70b

Please sign in to comment.