* @{
*/
virtual void init() { }
- virtual void get_health(Formatter *f,
- list<pair<health_status_t,string> > *detail) { }
+ virtual health_status_t get_health(
+ Formatter *f,
+ list<pair<health_status_t,string> > *detail) {
+ return HEALTH_OK;
+ }
virtual bool service_dispatch(Message *m);
virtual void start_epoch() { }
last_warned_percent = 0;
}
-void DataHealthService::get_health(Formatter *f,
- list<pair<health_status_t,string> > *detail)
+health_status_t DataHealthService::get_health(
+ Formatter *f,
+ list<pair<health_status_t,string> > *detail)
{
dout(10) << __func__ << dendl;
assert(f != NULL);
f->open_object_section("data_health");
f->open_array_section("mons");
+ health_status_t overall_status = HEALTH_OK;
+
for (map<entity_inst_t,DataStats>::iterator it = stats.begin();
it != stats.end(); ++it) {
string mon_name = mon->monmap->get_name(it->first.addr);
health_detail = "low disk space!";
}
+ if (overall_status > health_status)
+ overall_status = health_status;
+
if (detail && health_status != HEALTH_OK) {
stringstream ss;
ss << "mon." << mon_name << " addr " << it->first.addr
f->close_section(); // mons
f->close_section(); // data_health
+
+ return overall_status;
}
int DataHealthService::update_stats()
start_tick();
}
- virtual void get_health(Formatter *f,
+ virtual health_status_t get_health(Formatter *f,
list<pair<health_status_t,string> > *detail);
virtual int get_type() {
services.clear();
}
-void HealthMonitor::get_health(Formatter *f,
+health_status_t HealthMonitor::get_health(Formatter *f,
list<pair<health_status_t,string> > *detail) {
assert(f != NULL);
f->open_object_section("health");
* @{
*/
virtual void init();
- virtual void get_health(Formatter *f,
+ virtual health_status_t get_health(Formatter *f,
list<pair<health_status_t,string> > *detail);
virtual bool service_dispatch(Message *m);
HealthService *get() {
return static_cast<HealthService *>(RefCountedObject::get());
}
- virtual void get_health(Formatter *f,
+ virtual health_status_t get_health(Formatter *f,
list<pair<health_status_t,string> > *detail) = 0;
virtual int get_type() = 0;
virtual string get_name() const = 0;
if (f)
f->close_section();
- if (f)
- health_monitor->get_health(f, (detailbl ? &detail : NULL));
+ if (f) {
+ health_status_t hmstatus =
+ health_monitor->get_health(f, (detailbl ? &detail : NULL));
+ if (overall > hmstatus)
+ overall = hmstatus;
+ }
stringstream fss;
fss << overall;
virtual void init() { }
- virtual void get_health(Formatter *f,
+ virtual health_status_t get_health(Formatter *f,
list<pair<health_status_t,string> > *detail) = 0;
virtual int get_type() = 0;
virtual string get_name() const = 0;