]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: revise "ceph status" output 15396/head
authorJohn Spray <john.spray@redhat.com>
Wed, 31 May 2017 21:51:52 +0000 (17:51 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 31 May 2017 21:52:40 +0000 (17:52 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/FSMap.cc
src/mon/MgrMap.h
src/mon/Monitor.cc
src/mon/PGMap.cc
src/osd/OSDMap.cc

index 5d04bc65fff92feba7e8800b81c166b0256fc5a1..098436861d93e1e35dd180a71914e441f6b44779 100644 (file)
@@ -124,16 +124,15 @@ void FSMap::print_summary(Formatter *f, ostream *out) const
       f->dump_unsigned("max", fs->mds_map.max_mds);
     }
   } else {
-    *out << "e" << get_epoch() << ":";
     if (filesystems.size() == 1) {
       auto fs = filesystems.begin()->second;
-      *out << " " << fs->mds_map.up.size() << "/" << fs->mds_map.in.size() << "/"
+      *out << fs->mds_map.up.size() << "/" << fs->mds_map.in.size() << "/"
            << fs->mds_map.max_mds << " up";
     } else {
       for (auto i : filesystems) {
         auto fs = i.second;
-        *out << " " << fs->mds_map.fs_name << "-" << fs->mds_map.up.size() << "/"
-             << fs->mds_map.in.size() << "/" << fs->mds_map.max_mds << " up";
+        *out << fs->mds_map.fs_name << "-" << fs->mds_map.up.size() << "/"
+             << fs->mds_map.in.size() << "/" << fs->mds_map.max_mds << " up ";
       }
     }
   }
index e522ab4ba0f1ac74232c9b9a55da740b041cd370..9d30c953c720614edff0de88d54904a1ca0c8389 100644 (file)
@@ -126,10 +126,12 @@ public:
       dump(f);
     } else {
       if (get_active_gid() != 0) {
-       *ss << "active: " << get_active_name();
+       *ss << get_active_name();
         if (!available) {
           // If the daemon hasn't gone active yet, indicate that.
-          *ss << "(starting)";
+          *ss << "(active, starting)";
+        } else {
+          *ss << "(active)";
         }
         *ss << " ";
       } else {
index bc8f4fb79fcb17461deba3dd8326afe9262f1cf9..d4b4f87133ec94d64a35943101ef0fe86faef6da 100644 (file)
@@ -2587,23 +2587,41 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f)
     f->close_section();
     f->close_section();
   } else {
-    ss << "    cluster " << monmap->get_fsid() << "\n";
-    ss << "     health " << joinify(health.begin(), health.end(), 
-                                   string("\n            ")) << "\n";
-    ss << "     monmap " << *monmap << "\n";
-    ss << "            election epoch " << get_epoch()
-       << ", quorum " << get_quorum() << " " << get_quorum_names() << "\n";
-    if (mdsmon()->get_fsmap().filesystem_count() > 0) {
-      ss << "      fsmap " << mdsmon()->get_fsmap() << "\n";
+
+    ss << "  cluster:\n";
+    ss << "    id:     " << monmap->get_fsid() << "\n";
+    ss << "    health: " << joinify(health.begin(), health.end(), 
+                                 string("\n            ")) << "\n";
+    ss << "\n \n  services:\n";
+    const auto quorum_names = get_quorum_names();
+    const auto mon_count = monmap->mon_info.size();
+    ss << "    mon: " << mon_count << " daemons, quorum "
+       << quorum_names;
+    if (quorum_names.size() != mon_count) {
+      std::list<std::string> out_of_q;
+      for (size_t i = 0; i < monmap->ranks.size(); ++i) {
+        if (quorum.count(i) == 0) {
+          out_of_q.push_back(monmap->ranks[i]);
+        }
+      }
+      ss << ", out of quorum: " << joinify(out_of_q.begin(),
+                                           out_of_q.end(), std::string(", "));
     }
+    ss << "\n";
     if (mgrmon()->in_use()) {
-      ss << "        mgr ";
+      ss << "    mgr: ";
       mgrmon()->get_map().print_summary(nullptr, &ss);
       ss << "\n";
     }
-
+    if (mdsmon()->get_fsmap().filesystem_count() > 0) {
+      ss << "    mds: " << mdsmon()->get_fsmap() << "\n";
+    }
+    ss << "    osd: ";
     osdmon()->osdmap.print_summary(NULL, ss);
+
+    ss << "\n \n  data:\n";
     pgmon()->pg_map.print_summary(NULL, &ss);
+    ss << "\n ";
   }
 }
 
index 5b7243fc5f163725e95c1200c527274f7cf01644..89073d9fa7acca1177725abec72ec807d105ee77 100644 (file)
@@ -1615,7 +1615,6 @@ void PGMap::clear_delta()
 
 void PGMap::print_summary(Formatter *f, ostream *out) const
 {
-  std::stringstream ss;
   if (f)
     f->open_array_section("pgs_by_state");
 
@@ -1626,19 +1625,15 @@ void PGMap::print_summary(Formatter *f, ostream *out) const
        ++p) {
     state_by_count.insert(make_pair(p->second, p->first));
   }
-  for (multimap<int,int>::reverse_iterator p = state_by_count.rbegin();
-       p != state_by_count.rend();
-       ++p) {
-    if (f) {
+  if (f) {
+    for (multimap<int,int>::reverse_iterator p = state_by_count.rbegin();
+         p != state_by_count.rend();
+         ++p)
+    {
       f->open_object_section("pgs_by_state_element");
       f->dump_string("state_name", pg_state_string(p->second));
       f->dump_unsigned("count", p->first);
       f->close_section();
-    } else {
-      ss.setf(std::ios::right);
-      ss << "             " << std::setw(7) << p->first
-         << " " << pg_state_string(p->second) << "\n";
-      ss.unsetf(std::ios::right);
     }
   }
   if (f)
@@ -1654,57 +1649,89 @@ void PGMap::print_summary(Formatter *f, ostream *out) const
     f->dump_unsigned("bytes_avail", osd_sum.kb_avail * 1024ull);
     f->dump_unsigned("bytes_total", osd_sum.kb * 1024ull);
   } else {
-    *out << "      pgmap v" << version << ": "
-         << pg_stat.size() << " pgs, " << pg_pool_sum.size() << " pools, "
-         << prettybyte_t(pg_sum.stats.sum.num_bytes) << " data, "
-         << si_t(pg_sum.stats.sum.num_objects) << " objects\n";
-    *out << "            "
+    *out << "    pools:   " << pg_pool_sum.size() << " pools, "
+         << pg_stat.size() << " pgs\n";
+    *out << "    objects: " << si_t(pg_sum.stats.sum.num_objects) << " objects, "
+         << prettybyte_t(pg_sum.stats.sum.num_bytes) << "\n";
+    *out << "    usage:   "
          << kb_t(osd_sum.kb_used) << " used, "
          << kb_t(osd_sum.kb_avail) << " / "
          << kb_t(osd_sum.kb) << " avail\n";
+    *out << "    pgs:     ";
   }
 
 
+  bool pad = false;
   if (num_pg_active < num_pg) {
     float p = (float)num_pg_active / (float)num_pg;
     if (f) {
       f->dump_float("active_pgs_ratio", p);
     } else {
       char b[20];
-      snprintf(b, sizeof(b), "%.3lf", (1.0 - p) * 100.0);
-      *out << "            " << b << "% pgs inactive\n";
+      snprintf(b, sizeof(b), "%.3f", (1.0 - p) * 100.0);
+      *out << b << "% pgs inactive\n";
+      pad = true;
     }
   }
 
   list<string> sl;
   overall_recovery_summary(f, &sl);
   if (!f && !sl.empty()) {
-    for (list<string>::iterator p = sl.begin(); p != sl.end(); ++p)
-      *out << "            " << *p << "\n";
+    for (list<string>::iterator p = sl.begin(); p != sl.end(); ++p) {
+      if (pad) {
+        *out << "             ";
+      }
+      *out << *p << "\n";
+      pad = true;
+    }
   }
   sl.clear();
 
-  if (!f)
-    *out << ss.str();   // pgs by state
-
-  ostringstream ssr;
-  overall_recovery_rate_summary(f, &ssr);
-  if (!f && ssr.str().length())
-    *out << "recovery io " << ssr.str() << "\n";
+  if (!f) {
+    unsigned max_width = 1;
+    for (multimap<int,int>::reverse_iterator p = state_by_count.rbegin();
+         p != state_by_count.rend();
+         ++p)
+    {
+      std::stringstream ss;
+      ss << p->first;
+      max_width = MAX(ss.str().size(), max_width);
+    }
 
-  ssr.clear();
-  ssr.str("");
+    for (multimap<int,int>::reverse_iterator p = state_by_count.rbegin();
+         p != state_by_count.rend();
+         ++p)
+    {
+      if (pad) {
+        *out << "             ";
+      }
+      pad = true;
+      out->setf(std::ios::left);
+      *out << std::setw(max_width) << p->first
+           << " " << pg_state_string(p->second) << "\n";
+      out->unsetf(std::ios::left);
+    }
+  }
 
-  overall_client_io_rate_summary(f, &ssr);
-  if (!f && ssr.str().length())
-    *out << "  client io " << ssr.str() << "\n";
+  ostringstream ss_rec_io;
+  overall_recovery_rate_summary(f, &ss_rec_io);
+  ostringstream ss_client_io;
+  overall_client_io_rate_summary(f, &ss_client_io);
+  ostringstream ss_cache_io;
+  overall_cache_io_rate_summary(f, &ss_cache_io);
 
-  ssr.clear();
-  ssr.str("");
+  if (!f && (ss_client_io.str().length() || ss_rec_io.str().length()
+             || ss_cache_io.str().length())) {
+    *out << "\n \n";
+    *out << "  io:\n";
+  }
 
-  overall_cache_io_rate_summary(f, &ssr);
-  if (!f && ssr.str().length())
-    *out << "   cache io " << ssr.str() << "\n";
+  if (!f && ss_client_io.str().length())
+    *out << "    client:   " << ss_client_io.str() << "\n";
+  if (!f && ss_rec_io.str().length())
+    *out << "    recovery: " << ss_rec_io.str() << "\n";
+  if (!f && ss_cache_io.str().length())
+    *out << "    cache:    " << ss_cache_io.str() << "\n";
 }
 
 void PGMap::print_oneline_summary(Formatter *f, ostream *out) const
index 0f121291da37612f845187fe9015fe9dca8c7bdd..396aa56ec4f05e13d235896915c7eb7c60c75fce 100644 (file)
@@ -3076,8 +3076,7 @@ void OSDMap::print_summary(Formatter *f, ostream& out) const
     f->dump_unsigned("num_remapped_pgs", get_num_pg_temp());
     f->close_section();
   } else {
-    out << "     osdmap e" << get_epoch() << ": "
-       << get_num_osds() << " osds: "
+    out << get_num_osds() << " osds: "
        << get_num_up_osds() << " up, "
        << get_num_in_osds() << " in";
     if (get_num_pg_temp())
@@ -3092,7 +3091,7 @@ void OSDMap::print_summary(Formatter *f, ostream& out) const
 void OSDMap::print_oneline_summary(ostream& out) const
 {
   out << "e" << get_epoch() << ": "
-      << get_num_osds() << " osds: "
+      << get_num_osds() << " total, "
       << get_num_up_osds() << " up, "
       << get_num_in_osds() << " in";
   if (test_flag(CEPH_OSDMAP_FULL))