From: Sage Weil Date: Wed, 3 Apr 2013 15:37:50 +0000 (-0700) Subject: mon: limit warnings about low mon disk space X-Git-Tag: v0.62~98^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=85a77dfda6e9555fa42d04d6d0d4b8e4e8b8ff23;p=ceph.git mon: limit warnings about low mon disk space Only warn once per percentage point per epoch. Signed-off-by: Sage Weil --- diff --git a/src/mon/DataHealthService.cc b/src/mon/DataHealthService.cc index d465c39aed78..2410cbc4d680 100644 --- a/src/mon/DataHealthService.cc +++ b/src/mon/DataHealthService.cc @@ -51,6 +51,7 @@ void DataHealthService::start_epoch() // to hold the cluster back, even confusing the user, due to some possibly // outdated stats. stats.clear(); + last_warned_percent = 0; } void DataHealthService::get_health(Formatter *f, @@ -177,9 +178,13 @@ void DataHealthService::service_tick() // otherwise we may very well contribute to the consumption of the // already low available disk space. if (ours.latest_avail_percent <= g_conf->mon_data_avail_warn) { - mon->clog.warn() - << "reached concerning levels of available space on data store" - << " (" << ours.latest_avail_percent << "\% free)\n"; + if (ours.latest_avail_percent != last_warned_percent) + mon->clog.warn() + << "reached concerning levels of available space on data store" + << " (" << ours.latest_avail_percent << "\% free)\n"; + last_warned_percent = ours.latest_avail_percent; + } else { + last_warned_percent = 0; } } diff --git a/src/mon/DataHealthService.h b/src/mon/DataHealthService.h index 9d4e1e2210df..de7ab0ac2587 100644 --- a/src/mon/DataHealthService.h +++ b/src/mon/DataHealthService.h @@ -34,6 +34,8 @@ class DataHealthService : public HealthService { map stats; + int last_warned_percent; + void handle_tell(MMonHealth *m); int update_stats(); void share_stats(); @@ -58,7 +60,8 @@ protected: public: DataHealthService(Monitor *m) : - HealthService(m) + HealthService(m), + last_warned_percent(0) { set_update_period(g_conf->mon_health_data_update_interval); }