]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: warn if pg to osd ratio is too low
authorSage Weil <sage@inktank.com>
Sat, 21 Sep 2013 05:52:24 +0000 (22:52 -0700)
committerSage Weil <sage@inktank.com>
Mon, 23 Sep 2013 21:56:45 +0000 (14:56 -0700)
If there are not enough PGs relative to the number of in osds, warn.

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

index f62832396602da7ca177aa5b8ca19facdc3f6e9d..51212b5e4bf20bc03d0cc277beada25f91a5ad83 100644 (file)
@@ -158,6 +158,7 @@ OPTION(mon_timecheck_interval, OPT_FLOAT, 300.0) // on leader, timecheck (clock
 OPTION(mon_accept_timeout, OPT_FLOAT, 10.0)    // on leader, if paxos update isn't accepted
 OPTION(mon_pg_create_interval, OPT_FLOAT, 30.0) // no more than every 30s
 OPTION(mon_pg_stuck_threshold, OPT_INT, 300) // number of seconds after which pgs can be considered inactive, unclean, or stale (see doc/control.rst under dump_stuck for more info)
+OPTION(mon_pg_warn_min_per_osd, OPT_INT, 20)  // min # pgs per (in) osd before we warn the admin
 OPTION(mon_osd_full_ratio, OPT_FLOAT, .95) // what % full makes an OSD "full"
 OPTION(mon_osd_nearfull_ratio, OPT_FLOAT, .85) // what % full makes an OSD near full
 OPTION(mon_globalid_prealloc, OPT_INT, 100)   // how many globalids to prealloc
index 2a677be61d9ee7a6465758fbf12320477a330560..b27ba7749f467e2d7c5fd7458f8cf029a4bd61d2 100644 (file)
@@ -1847,6 +1847,19 @@ void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
       detail->push_back(make_pair(HEALTH_ERR, ss.str()));
     }
   }
+
+  // pg skew
+  int num_in = mon->osdmon()->osdmap.get_num_in_osds();
+  if (num_in && g_conf->mon_pg_warn_min_per_osd > 0) {
+    int per = pg_map.pg_stat.size() / num_in;
+    if (per < g_conf->mon_pg_warn_min_per_osd) {
+      ostringstream ss;
+      ss << "too few pgs per osd (" << per << " < min " << g_conf->mon_pg_warn_min_per_osd << ")";
+      summary.push_back(make_pair(HEALTH_WARN, ss.str()));
+      if (detail)
+       detail->push_back(make_pair(HEALTH_WARN, ss.str()));
+    }
+  }
 }
 
 void PGMonitor::check_full_osd_health(list<pair<health_status_t,string> >& summary,