From 956e2e227402541169bd685612835861874eac7b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 6 Mar 2012 15:38:31 -0800 Subject: [PATCH] mon: list nearfull/full osd detail Signed-off-by: Sage Weil --- src/mon/PGMonitor.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index e34d62bc82b07..016933f310e1e 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1237,6 +1237,17 @@ enum health_status_t PGMonitor::get_health(list& summary, list * ostringstream ss; ss << pg_map.nearfull_osds.size() << " near full osd(s)"; summary.push_back(ss.str()); + if (detail) { + for (set::iterator p = pg_map.nearfull_osds.begin(); + p != pg_map.nearfull_osds.end(); + ++p) { + ostringstream ss; + const osd_stat_t& os = pg_map.osd_stat.find(*p)->second; + int ratio = (int)(((float)os.kb_used) / (float) os.kb * 100.0); + ss << "osd." << *p << " is near full at " << ratio << "%"; + detail->push_back(ss.str()); + } + } if (ret > HEALTH_WARN) ret = HEALTH_WARN; } @@ -1244,6 +1255,17 @@ enum health_status_t PGMonitor::get_health(list& summary, list * ostringstream ss; ss << pg_map.full_osds.size() << " full osd(s)"; summary.push_back(ss.str()); + if (detail) { + for (set::iterator p = pg_map.nearfull_osds.begin(); + p != pg_map.nearfull_osds.end(); + ++p) { + ostringstream ss; + const osd_stat_t& os = pg_map.osd_stat.find(*p)->second; + int ratio = (int)(((float)os.kb_used) / (float) os.kb * 100.0); + ss << "osd." << *p << " is full at " << ratio << "%"; + detail->push_back(ss.str()); + } + } if (ret > HEALTH_ERR) ret = HEALTH_ERR; } -- 2.39.5