From ae1773fd1910e678010070d8c4b13665f7f11e8c Mon Sep 17 00:00:00 2001 From: mlausch Date: Fri, 2 Jan 2015 15:16:32 +0100 Subject: [PATCH 1/2] fix if some OSDs are in the crushmap with status "DNE" and add unhealty osds only once in the unhealthy list --- ceph-dash.py | 11 +++++++++-- config.json | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ceph-dash.py b/ceph-dash.py index b4ef1f9..ed032e0 100755 --- a/ceph-dash.py +++ b/ceph-dash.py @@ -99,15 +99,22 @@ def get_unhealthy_osd_details(osd_status): """ get all unhealthy osds from osd status """ unhealthy_osds = list() + import pprint for obj in osd_status['nodes']: if obj['type'] == 'osd': + #if OSD does not exists (DNE in osd tree) skip this entry + if obj['exists'] == 0: continue if obj['status'] == 'down' or obj['status'] == 'out': - unhealthy_osds.append({ + #It is possible to have one host in more than one branch in the tree. + #Add each unhealthy OSD only once in the list + entry = { 'name': obj['name'], 'status': obj['status'], 'host': find_host_for_osd(obj['id'], osd_status) - }) + } + if entry not in unhealthy_osds: + unhealthy_osds.append(entry) return unhealthy_osds diff --git a/config.json b/config.json index 1f75904..dbad3ec 100644 --- a/config.json +++ b/config.json @@ -1,3 +1,5 @@ { - "ceph_config": "/etc/ceph/ceph.conf" + "ceph_config": "./ceph.conf", + "keyring": "./ceph.keyring", + "client_name": "client.monitoring" } From 8aeaf1df8e1fadbc593547b78f7d49b89d09390c Mon Sep 17 00:00:00 2001 From: mlausch Date: Fri, 2 Jan 2015 15:21:57 +0100 Subject: [PATCH 2/2] - --- ceph-dash.py | 1 - config.json | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ceph-dash.py b/ceph-dash.py index ed032e0..0961de0 100755 --- a/ceph-dash.py +++ b/ceph-dash.py @@ -99,7 +99,6 @@ def get_unhealthy_osd_details(osd_status): """ get all unhealthy osds from osd status """ unhealthy_osds = list() - import pprint for obj in osd_status['nodes']: if obj['type'] == 'osd': diff --git a/config.json b/config.json index dbad3ec..1f75904 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,3 @@ { - "ceph_config": "./ceph.conf", - "keyring": "./ceph.keyring", - "client_name": "client.monitoring" + "ceph_config": "/etc/ceph/ceph.conf" }