]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: show legacy health warning in `status` output 17930/head
authorJohn Spray <john.spray@redhat.com>
Sat, 23 Sep 2017 12:48:36 +0000 (13:48 +0100)
committerJohn Spray <john.spray@redhat.com>
Sat, 23 Sep 2017 14:39:51 +0000 (15:39 +0100)
Previously you only got the text of this if you were
either looking at "health detail" or if you had
already set the preluminous_compat setting (in which
case you presumably were already aware so the message
isn't doing much).

Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/Monitor.cc

index 4e5914aa7caa447b70d83488668398505b218c52..365e9d2c6fee344c4e26491843344c1629979d24 100644 (file)
@@ -2495,21 +2495,26 @@ health_status_t Monitor::get_health_status(
     *plain += "\n";
   }
 
+  const std::string old_fields_message = "'ceph health' JSON format has "
+    "changed in luminous. If you see this your monitoring system is "
+    "scraping the wrong fields. Disable this with 'mon health preluminous "
+    "compat warning = false'";
+
   if (f && (compat || compat_warn)) {
     health_status_t cr = compat_warn ? min(HEALTH_WARN, r) : r;
+    f->open_array_section("summary");
+    if (compat_warn) {
+      f->open_object_section("item");
+      f->dump_stream("severity") << HEALTH_WARN;
+      f->dump_string("summary", old_fields_message);
+      f->close_section();
+    }
     if (compat) {
-      f->open_array_section("summary");
-      if (compat_warn) {
-       f->open_object_section("item");
-       f->dump_stream("severity") << HEALTH_WARN;
-       f->dump_string("summary", "'ceph health' JSON format has changed in luminous; update your health monitoring scripts");
-       f->close_section();
-      }
       for (auto& svc : paxos_service) {
-       svc->get_health_checks().dump_summary_compat(f);
+        svc->get_health_checks().dump_summary_compat(f);
       }
-      f->close_section();
     }
+    f->close_section();
     f->dump_stream("overall_status") << cr;
   }
 
@@ -2517,7 +2522,7 @@ health_status_t Monitor::get_health_status(
     if (f && (compat || compat_warn)) {
       f->open_array_section("detail");
       if (compat_warn) {
-       f->dump_string("item", "'ceph health' JSON format has changed in luminous. If you see this your monitoring system is scraping the wrong fields. Disable this with 'mon health preluminous compat warning = false'");
+       f->dump_string("item", old_fields_message);
       }
     }