}
}
- get_pools_health(summary, detail);
+ for (auto it : osdmap.get_pools()) {
+ const pg_pool_t &pool = it.second;
+ if (pool.has_flag(pg_pool_t::FLAG_FULL)) {
+ const string& pool_name = osdmap.get_pool_name(it.first);
+ stringstream ss;
+ ss << "pool '" << pool_name << "' is full";
+ summary.push_back(make_pair(HEALTH_WARN, ss.str()));
+ if (detail)
+ detail->push_back(make_pair(HEALTH_WARN, ss.str()));
+ }
+ }
}
}
return ret;
}
-void OSDMonitor::get_pools_health(
- list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const
-{
- auto& pools = osdmap.get_pools();
- for (auto it = pools.begin(); it != pools.end(); ++it) {
- const pool_stat_t *pstat = mon->pgservice->get_pool_stat(it->first);
- if (!pstat)
- continue;
- const object_stat_sum_t& sum = pstat->stats.sum;
- const pg_pool_t &pool = it->second;
- const string& pool_name = osdmap.get_pool_name(it->first);
-
- if (pool.has_flag(pg_pool_t::FLAG_FULL)) {
- // uncomment these asserts if/when we update the FULL flag on pg_stat update
- //assert((pool.quota_max_objects > 0) || (pool.quota_max_bytes > 0));
-
- stringstream ss;
- ss << "pool '" << pool_name << "' is full";
- summary.push_back(make_pair(HEALTH_WARN, ss.str()));
- if (detail)
- detail->push_back(make_pair(HEALTH_WARN, ss.str()));
- }
-
- float warn_threshold = (float)g_conf->mon_pool_quota_warn_threshold/100;
- float crit_threshold = (float)g_conf->mon_pool_quota_crit_threshold/100;
-
- if (pool.quota_max_objects > 0) {
- stringstream ss;
- health_status_t status = HEALTH_OK;
- if ((uint64_t)sum.num_objects >= pool.quota_max_objects) {
- // uncomment these asserts if/when we update the FULL flag on pg_stat update
- //assert(pool.has_flag(pg_pool_t::FLAG_FULL));
- } else if (crit_threshold > 0 &&
- sum.num_objects >= pool.quota_max_objects*crit_threshold) {
- ss << "pool '" << pool_name
- << "' has " << sum.num_objects << " objects"
- << " (max " << pool.quota_max_objects << ")";
- status = HEALTH_ERR;
- } else if (warn_threshold > 0 &&
- sum.num_objects >= pool.quota_max_objects*warn_threshold) {
- ss << "pool '" << pool_name
- << "' has " << sum.num_objects << " objects"
- << " (max " << pool.quota_max_objects << ")";
- status = HEALTH_WARN;
- }
- if (status != HEALTH_OK) {
- pair<health_status_t,string> s(status, ss.str());
- summary.push_back(s);
- if (detail)
- detail->push_back(s);
- }
- }
-
- if (pool.quota_max_bytes > 0) {
- health_status_t status = HEALTH_OK;
- stringstream ss;
- if ((uint64_t)sum.num_bytes >= pool.quota_max_bytes) {
- // uncomment these asserts if/when we update the FULL flag on pg_stat update
- //assert(pool.has_flag(pg_pool_t::FLAG_FULL));
- } else if (crit_threshold > 0 &&
- sum.num_bytes >= pool.quota_max_bytes*crit_threshold) {
- ss << "pool '" << pool_name
- << "' has " << si_t(sum.num_bytes) << " bytes"
- << " (max " << si_t(pool.quota_max_bytes) << ")";
- status = HEALTH_ERR;
- } else if (warn_threshold > 0 &&
- sum.num_bytes >= pool.quota_max_bytes*warn_threshold) {
- ss << "pool '" << pool_name
- << "' has " << si_t(sum.num_bytes) << " bytes"
- << " (max " << si_t(pool.quota_max_bytes) << ")";
- status = HEALTH_WARN;
- }
- if (status != HEALTH_OK) {
- pair<health_status_t,string> s(status, ss.str());
- summary.push_back(s);
- if (detail)
- detail->push_back(s);
- }
- }
- }
-}
-
-
int OSDMonitor::prepare_new_pool(MonOpRequestRef op)
{
op->mark_osdmon_event(__func__);
ss << pgs_count << " unscrubbed pgs";
summary.push_back(make_pair(HEALTH_WARN, ss.str()));
}
-
}
}
}
}
+ for (auto it : pools) {
+ auto it2 = pg_pool_sum.find(it.first);
+ if (it2 == pg_pool_sum.end()) {
+ continue;
+ }
+ const pool_stat_t *pstat = &it2->second;
+ const object_stat_sum_t& sum = pstat->stats.sum;
+ const string& pool_name = osdmap.get_pool_name(it.first);
+ const pg_pool_t &pool = it.second;
+
+ float warn_threshold = (float)g_conf->mon_pool_quota_warn_threshold/100;
+ float crit_threshold = (float)g_conf->mon_pool_quota_crit_threshold/100;
+
+ if (pool.quota_max_objects > 0) {
+ stringstream ss;
+ health_status_t status = HEALTH_OK;
+ if ((uint64_t)sum.num_objects >= pool.quota_max_objects) {
+ } else if (crit_threshold > 0 &&
+ sum.num_objects >= pool.quota_max_objects*crit_threshold) {
+ ss << "pool '" << pool_name
+ << "' has " << sum.num_objects << " objects"
+ << " (max " << pool.quota_max_objects << ")";
+ status = HEALTH_ERR;
+ } else if (warn_threshold > 0 &&
+ sum.num_objects >= pool.quota_max_objects*warn_threshold) {
+ ss << "pool '" << pool_name
+ << "' has " << sum.num_objects << " objects"
+ << " (max " << pool.quota_max_objects << ")";
+ status = HEALTH_WARN;
+ }
+ if (status != HEALTH_OK) {
+ pair<health_status_t,string> s(status, ss.str());
+ summary.push_back(s);
+ if (detail)
+ detail->push_back(s);
+ }
+ }
+
+ if (pool.quota_max_bytes > 0) {
+ health_status_t status = HEALTH_OK;
+ stringstream ss;
+ if ((uint64_t)sum.num_bytes >= pool.quota_max_bytes) {
+ } else if (crit_threshold > 0 &&
+ sum.num_bytes >= pool.quota_max_bytes*crit_threshold) {
+ ss << "pool '" << pool_name
+ << "' has " << si_t(sum.num_bytes) << " bytes"
+ << " (max " << si_t(pool.quota_max_bytes) << ")";
+ status = HEALTH_ERR;
+ } else if (warn_threshold > 0 &&
+ sum.num_bytes >= pool.quota_max_bytes*warn_threshold) {
+ ss << "pool '" << pool_name
+ << "' has " << si_t(sum.num_bytes) << " bytes"
+ << " (max " << si_t(pool.quota_max_bytes) << ")";
+ status = HEALTH_WARN;
+ }
+ if (status != HEALTH_OK) {
+ pair<health_status_t,string> s(status, ss.str());
+ summary.push_back(s);
+ if (detail)
+ detail->push_back(s);
+ }
+ }
+ }
+
print_unscrubbed_pgs(pg_stat, summary, detail, cct);
}