Skip to content

Commit

Permalink
Merge pull request #3 from vinted/feature/enable_ceph_mgr_socket_metrics
Browse files Browse the repository at this point in the history
Enable ceph-mgr socket metrics
  • Loading branch information
Seitanas authored Feb 13, 2020
2 parents 07037ab + 83a9319 commit 98fa017
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ func GetDeviceType(socketName string) map[string]string {
device["type"] = "ceph_radosgw"
device["name"] = strings.ReplaceAll(re.FindString(socketName), ".", "")
}
if strings.Contains(socketName, "mgr.") {
log.Debug("Device is a mgr")
var re = regexp.MustCompile(`mgr(.[0-9]*)`)
device["type"] = "ceph_mgr"
device["name"] = strings.ReplaceAll(re.FindString(socketName), ".", "")
}
log.Debug("Device:", device)
return device
}
Expand Down
4 changes: 4 additions & 0 deletions collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func TestGetDeviceType(t *testing.T) {
if value["type"] != "ceph_radosgw" || value["name"] != "radosgw" {
t.Errorf("GetDeviceType failed. Got: type: %s, name: %s", value["type"], value["name"])
}
value = GetDeviceType("/var/run/ceph/ceph-cluster-client.radosgw.test-ceph-mgr.asok")
if value["type"] != "ceph_mgr" || value["name"] != "mgr" {
t.Errorf("GetDeviceType failed. Got: type: %s, name: %s", value["type"], value["name"])
}
}

func TestLoadJson(t *testing.T) {
Expand Down

0 comments on commit 98fa017

Please sign in to comment.