Merge pull request #180 from syhpoon/BLOCK-2615

fix rbd-mirror daemon format in Nautilus
This commit is contained in:
Max Kuznetsov 2020-10-07 16:09:02 -04:00 committed by GitHub
commit c9552f0f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 10 deletions

View File

@ -964,7 +964,7 @@ type cephHealthStats struct {
ServiceMap struct {
Services struct {
RbdMirror struct {
Daemons map[string]interface{} `json:"daemons"`
Daemons map[string]json.RawMessage `json:"daemons"`
} `json:"rbd-mirror"`
} `json:"services"`
} `json:"servicemap"`
@ -1307,13 +1307,22 @@ func (c *ClusterHealthCollector) collect(ch chan<- prometheus.Metric) error {
c.MgrsActive.Set(float64(activeMgr))
c.MgrsNum.Set(float64(activeMgr + len(stats.MgrMap.StandBys)))
for name := range stats.ServiceMap.Services.RbdMirror.Daemons {
for name, data := range stats.ServiceMap.Services.RbdMirror.Daemons {
if name == "summary" {
continue
}
ch <- prometheus.MustNewConstMetric(
c.RbdMirrorUp, prometheus.GaugeValue, 1.0, name)
md := struct {
Metadata struct {
Id string `json:"id"`
} `json:"metadata"`
}{}
// Extract id from metadata
if err := json.Unmarshal(data, &md); err == nil {
ch <- prometheus.MustNewConstMetric(
c.RbdMirrorUp, prometheus.GaugeValue, 1.0, md.Metadata.Id)
}
}
return nil

View File

@ -711,16 +711,23 @@ $ sudo ceph -s
"rbd-mirror": {
"daemons": {
"summary": "",
"prod-mon01-block01": {
"addr": "10.78.41.10:0/1272328707",
"681363": {
"start_epoch": 4,
"start_stamp": "2020-09-24 04:27:12.310285",
"addr": "10.39.70.112:0/2856123533",
"metadata": {
"arch": "x86_64"
"arch": "x86_64",
"id": "prod-mon01-block01"
}
},
"prod-mon02-block01": {
"addr": "10.78.41.11:0/2337288266",
"681474": {
"start_epoch": 6,
"start_stamp": "2020-09-24 04:28:44.500861",
"addr": "10.39.70.111:0/3132809711",
"metadata": {
"arch": "x86_64"
"arch": "x86_64",
"id": "prod-mon02-block01"
}
}
}