]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: limit warnings about low mon disk space 192/head
authorSage Weil <sage@inktank.com>
Wed, 3 Apr 2013 15:37:50 +0000 (08:37 -0700)
committerSage Weil <sage@inktank.com>
Wed, 3 Apr 2013 15:37:50 +0000 (08:37 -0700)
Only warn once per percentage point per epoch.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/DataHealthService.cc
src/mon/DataHealthService.h

index d465c39aed78910ff8a3f05983181a144e3d5ba8..2410cbc4d680b142bf7e067750d91c5cc72e840e 100644 (file)
@@ -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;
   }
 }
 
index 9d4e1e2210dfc6007f0198921211bfe4638f65ca..de7ab0ac25877af1f9e6735842a8759b38697914 100644 (file)
@@ -34,6 +34,8 @@ class DataHealthService :
   public HealthService
 {
   map<entity_inst_t,DataStats> 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);
   }