From: Sage Weil Date: Tue, 27 Jun 2017 18:33:00 +0000 (-0400) Subject: mon/Monitor: periodically log new-style health warnings to log X-Git-Tag: v12.1.1~58^2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=57a8747f1d44cecbf8ad444851d12865e6184c6f;p=ceph.git mon/Monitor: periodically log new-style health warnings to log Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 0330236a840..2d9f44ac682 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2424,27 +2424,46 @@ void Monitor::do_health_to_clog(bool force) dout(10) << __func__ << (force ? " (force)" : "") << dendl; - list status; - health_status_t overall = get_health(status, NULL, NULL); - - dout(25) << __func__ - << (force ? " (force)" : "") - << dendl; + if (osdmon()->osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS) { + string summary; + health_status_t level = get_health_status(false, nullptr, &summary); + if (!force && + summary == health_status_cache.summary && + level == health_status_cache.overall) + return; + if (level == HEALTH_OK) + clog->info() << summary; + else if (level == HEALTH_WARN) + clog->warn() << summary; + else if (level == HEALTH_ERR) + clog->error() << summary; + else + ceph_abort(); + health_status_cache.summary = summary; + health_status_cache.overall = level; + } else { + // for jewel only + list status; + health_status_t overall = get_health(status, NULL, NULL); + dout(25) << __func__ + << (force ? " (force)" : "") + << dendl; - string summary = joinify(status.begin(), status.end(), string("; ")); + string summary = joinify(status.begin(), status.end(), string("; ")); - if (!force && - overall == health_status_cache.overall && - !health_status_cache.summary.empty() && - health_status_cache.summary == summary) { - // we got a dup! - return; - } + if (!force && + overall == health_status_cache.overall && + !health_status_cache.summary.empty() && + health_status_cache.summary == summary) { + // we got a dup! + return; + } - clog->info() << summary; + clog->info() << summary; - health_status_cache.overall = overall; - health_status_cache.summary = summary; + health_status_cache.overall = overall; + health_status_cache.summary = summary; + } } health_status_t Monitor::get_health_status(