From: John Spray Date: Sat, 23 Sep 2017 12:48:36 +0000 (+0100) Subject: mon: show legacy health warning in `status` output X-Git-Tag: v12.2.2~179^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F17930%2Fhead;p=ceph.git mon: show legacy health warning in `status` output 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 --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 4e5914aa7caa..365e9d2c6fee 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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); } }