}
void DataHealthService::get_health(
- Formatter *f,
list<pair<health_status_t,string> >& summary,
list<pair<health_status_t,string> > *detail)
{
dout(10) << __func__ << dendl;
- if (f) {
- f->open_object_section("data_health");
- f->open_array_section("mons");
- }
-
for (map<entity_inst_t,DataStats>::iterator it = stats.begin();
it != stats.end(); ++it) {
string mon_name = mon->monmap->get_name(it->first.addr);
if (detail)
detail->push_back(make_pair(health_status, ss.str()));
}
-
- if (f) {
- f->open_object_section("mon");
- f->dump_string("name", mon_name.c_str());
- // leave this unenclosed by an object section to avoid breaking backward-compatibility
- stats.dump(f);
- f->dump_stream("health") << health_status;
- if (health_status != HEALTH_OK)
- f->dump_string("health_detail", health_detail);
- f->close_section();
- }
- }
-
- if (f) {
- f->close_section(); // mons
- f->close_section(); // data_health
}
}