]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: list nearfull/full osd detail
authorSage Weil <sage@newdream.net>
Tue, 6 Mar 2012 23:38:31 +0000 (15:38 -0800)
committerSage Weil <sage@newdream.net>
Wed, 7 Mar 2012 01:05:29 +0000 (17:05 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/PGMonitor.cc

index e34d62bc82b07ca08f1b28090828b3fd0daa2139..016933f310e1eb65693f1b928cb219c69b48272b 100644 (file)
@@ -1237,6 +1237,17 @@ enum health_status_t PGMonitor::get_health(list<string>& summary, list<string> *
     ostringstream ss;
     ss << pg_map.nearfull_osds.size() << " near full osd(s)";
     summary.push_back(ss.str());
+    if (detail) {
+      for (set<int>::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<string>& summary, list<string> *
     ostringstream ss;
     ss << pg_map.full_osds.size() << " full osd(s)";
     summary.push_back(ss.str());
+    if (detail) {
+      for (set<int>::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;
   }