~ubuntu-branches/debian/jessie/ceph/jessie

« back to all changes in this revision

Viewing changes to src/mon/DataHealthService.cc

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2014-07-18 02:33:39 UTC
  • mfrom: (1.2.17)
  • Revision ID: package-import@ubuntu.com-20140718023339-03jdyr6dxl2hx00y
Tags: 0.80.4-1
* New upstream release [July 2014].
* New patches:
  + rbdmap1-mount.patch
  + rbdmap2-hooks.patch
  + rbdmap3-lazyumount.patch
  + bug-8821.patch
* radosgw: removed unused lintian overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
  last_warned_percent = 0;
69
69
}
70
70
 
71
 
health_status_t DataHealthService::get_health(
 
71
void DataHealthService::get_health(
72
72
    Formatter *f,
 
73
    list<pair<health_status_t,string> >& summary,
73
74
    list<pair<health_status_t,string> > *detail)
74
75
{
75
76
  dout(10) << __func__ << dendl;
78
79
    f->open_array_section("mons");
79
80
  }
80
81
 
81
 
  health_status_t overall_status = HEALTH_OK;
82
 
 
83
82
  for (map<entity_inst_t,DataStats>::iterator it = stats.begin();
84
83
       it != stats.end(); ++it) {
85
84
    string mon_name = mon->monmap->get_name(it->first.addr);
89
88
    string health_detail;
90
89
    if (stats.latest_avail_percent <= g_conf->mon_data_avail_crit) {
91
90
      health_status = HEALTH_ERR;
92
 
      health_detail = "shutdown iminent!";
 
91
      health_detail = "low disk space, shutdown imminent";
93
92
    } else if (stats.latest_avail_percent <= g_conf->mon_data_avail_warn) {
94
93
      health_status = HEALTH_WARN;
95
 
      health_detail = "low disk space!";
 
94
      health_detail = "low disk space";
96
95
    }
97
96
 
98
97
    if (stats.store_stats.bytes_total >= g_conf->mon_leveldb_size_warn) {
107
106
      health_detail.append(ss.str());
108
107
    }
109
108
 
110
 
    if (overall_status > health_status)
111
 
      overall_status = health_status;
112
 
 
113
 
    if (detail && health_status != HEALTH_OK) {
 
109
    if (health_status != HEALTH_OK) {
114
110
      stringstream ss;
115
 
      ss << "mon." << mon_name << " addr " << it->first.addr
116
 
          << " has " << stats.latest_avail_percent
117
 
          << "\% avail disk space -- " << health_detail;
118
 
      detail->push_back(make_pair(health_status, ss.str()));
 
111
      ss << "mon." << mon_name << " " << health_detail;
 
112
      summary.push_back(make_pair(health_status, ss.str()));
 
113
      ss << " -- " <<  stats.latest_avail_percent << "% avail";
 
114
      if (detail)
 
115
        detail->push_back(make_pair(health_status, ss.str()));
119
116
    }
120
117
 
121
118
    if (f) {
134
131
    f->close_section(); // mons
135
132
    f->close_section(); // data_health
136
133
  }
137
 
 
138
 
  return overall_status;
139
134
}
140
135
 
141
136
int DataHealthService::update_store_stats(DataStats &ours)