OPTION(mon_data_avail_crit, OPT_INT, 5)
OPTION(mon_data_avail_warn, OPT_INT, 30)
OPTION(mon_data_size_warn, OPT_U64, 15*1024*1024*1024) // issue a warning when the monitor's data store goes over 15GB (in bytes)
+OPTION(mon_warn_not_scrubbed, OPT_INT, 0)
+OPTION(mon_warn_not_deep_scrubbed, OPT_INT, 0)
OPTION(mon_scrub_interval, OPT_INT, 3600*24) // once a day
OPTION(mon_scrub_timeout, OPT_INT, 60*5) // let's give it 5 minutes; why not.
OPTION(mon_scrub_max_keys, OPT_INT, 100) // max number of keys to scrub each time
}
void MDSMonitor::get_health(list<pair<health_status_t, string> >& summary,
- list<pair<health_status_t, string> > *detail) const
+ list<pair<health_status_t, string> > *detail,
+ CephContext* cct) const
{
mdsmap.get_health(summary, detail);
bool prepare_offload_targets(MonOpRequestRef op);
void get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const;
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const override;
int fail_mds(std::ostream &ss, const std::string &arg);
void fail_mds_gid(mds_gid_t gid);
p != paxos_service.end();
++p) {
PaxosService *s = *p;
- s->get_health(summary, detailbl ? &detail : NULL);
+ s->get_health(summary, detailbl ? &detail : NULL, cct);
}
health_monitor->get_health(f, summary, (detailbl ? &detail : NULL));
}
void MonmapMonitor::get_health(list<pair<health_status_t, string> >& summary,
- list<pair<health_status_t, string> > *detail) const
+ list<pair<health_status_t, string> > *detail,
+ CephContext *cct) const
{
int max = mon->monmap->size();
int actual = mon->get_quorum().size();
bool prepare_command(MonOpRequestRef op);
void get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const;
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const override;
int get_monmap(bufferlist &bl);
int get_monmap(MonMap &m);
}
void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const
{
int num_osds = osdmap.get_num_osds();
int parse_osd_id(const char *s, stringstream *pss);
void get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const;
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const override;
bool preprocess_command(MonOpRequestRef op);
bool prepare_command(MonOpRequestRef op);
bool prepare_command_impl(MonOpRequestRef op, map<string,cmd_vartype>& cmdmap);
return sum;
}
+namespace {
+ enum class scrubbed_or_deepscrubbed_t { SCRUBBED, DEEPSCRUBBED };
+
+ void print_unscrubbed_detailed(const std::pair<const pg_t,pg_stat_t> &pg_entry,
+ list<pair<health_status_t,string> > *detail,
+ scrubbed_or_deepscrubbed_t how_scrubbed) {
+
+ std::stringstream ss;
+ const auto& pg_stat(pg_entry.second);
+
+ ss << "pg " << pg_entry.first << " is not ";
+ if (how_scrubbed == scrubbed_or_deepscrubbed_t::SCRUBBED) {
+ ss << "scrubbed, last_scrub_stamp "
+ << pg_stat.last_scrub_stamp;
+ } else if (how_scrubbed == scrubbed_or_deepscrubbed_t::DEEPSCRUBBED) {
+ ss << "deep-scrubbed, last_deep_scrub_stamp "
+ << pg_stat.last_deep_scrub_stamp;
+ }
+
+ detail->push_back(make_pair(HEALTH_WARN, ss.str()));
+ }
+
+
+ using pg_stat_map_t = const ceph::unordered_map<pg_t,pg_stat_t>;
+
+ void print_unscrubbed_pgs(pg_stat_map_t& pg_stats,
+ list<pair<health_status_t,string> > &summary,
+ list<pair<health_status_t,string> > *detail,
+ const CephContext* cct) {
+ int pgs_count = 0;
+ const utime_t now = ceph_clock_now(nullptr);
+ for (const auto& pg_entry : pg_stats) {
+ const auto& pg_stat(pg_entry.second);
+ const utime_t time_since_ls = now - pg_stat.last_scrub_stamp;
+ const utime_t time_since_lds = now - pg_stat.last_deep_scrub_stamp;
+
+ const int mon_warn_not_scrubbed =
+ cct->_conf->mon_warn_not_scrubbed + cct->_conf->mon_scrub_interval;
+
+ const int mon_warn_not_deep_scrubbed =
+ cct->_conf->mon_warn_not_deep_scrubbed + cct->_conf->mon_scrub_interval;
+
+ bool not_scrubbed = (time_since_ls >= mon_warn_not_scrubbed &&
+ cct->_conf->mon_warn_not_scrubbed != 0);
+
+ bool not_deep_scrubbed = (time_since_lds >= mon_warn_not_deep_scrubbed &&
+ cct->_conf->mon_warn_not_deep_scrubbed != 0);
+
+ if (detail != nullptr) {
+ if (not_scrubbed) {
+ print_unscrubbed_detailed(pg_entry,
+ detail,
+ scrubbed_or_deepscrubbed_t::SCRUBBED);
+ } else if (not_deep_scrubbed) {
+ print_unscrubbed_detailed(pg_entry,
+ detail,
+ scrubbed_or_deepscrubbed_t::DEEPSCRUBBED);
+ }
+ }
+ if (not_scrubbed || not_deep_scrubbed) {
+ ++pgs_count;
+ }
+ }
+
+ if (pgs_count > 0) {
+ std::stringstream ss;
+ ss << pgs_count << " unscrubbed pgs";
+ summary.push_back(make_pair(HEALTH_WARN, ss.str()));
+ }
+
+ }
+}
+
void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const
{
map<string,int> note;
ceph::unordered_map<int,int>::const_iterator p = pg_map.num_pg_by_state.begin();
}
}
}
+
+ print_unscrubbed_pgs(pg_map.pg_stat, summary, detail, cct);
+
}
void PGMonitor::check_full_osd_health(list<pair<health_status_t,string> >& summary,
list<pair<health_status_t,string> > *detail) const;
void get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const;
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const override;
void check_full_osd_health(list<pair<health_status_t,string> >& summary,
list<pair<health_status_t,string> > *detail,
const set<int>& s, const char *desc, health_status_t sev) const;
* @param detail optional list of detailed problem reports; may be NULL
*/
virtual void get_health(list<pair<health_status_t,string> >& summary,
- list<pair<health_status_t,string> > *detail) const { }
+ list<pair<health_status_t,string> > *detail,
+ CephContext *cct) const { }
private:
/**