From 1fc6a51a416761d9ccd172937cda1a6b1c11faad Mon Sep 17 00:00:00 2001 From: John Spray Date: Sat, 23 Sep 2017 13:48:36 +0100 Subject: [PATCH] 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 --- src/mon/Monitor.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) 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); } } -- 2.47.3