| 3215 | } |
| 3216 | |
| 3217 | void DaemonServer::send_report() |
| 3218 | { |
| 3219 | if (!pgmap_ready) { |
| 3220 | if (ceph_clock_now() - started_at > g_conf().get_val<int64_t>("mgr_stats_period") * 4.0) { |
| 3221 | pgmap_ready = true; |
| 3222 | reported_osds.clear(); |
| 3223 | dout(1) << "Giving up on OSDs that haven't reported yet, sending " |
| 3224 | << "potentially incomplete PG state to mon" << dendl; |
| 3225 | } else { |
| 3226 | dout(1) << "Not sending PG status to monitor yet, waiting for OSDs" |
| 3227 | << dendl; |
| 3228 | return; |
| 3229 | } |
| 3230 | } |
| 3231 | |
| 3232 | auto m = ceph::make_message<MMonMgrReport>(); |
| 3233 | m->gid = monc->get_global_id(); |
| 3234 | py_modules.get_health_checks(&m->health_checks); |
| 3235 | py_modules.get_progress_events(&m->progress_events); |
| 3236 | |
| 3237 | cluster_state.with_mutable_pgmap([&](PGMap& pg_map) { |
| 3238 | cluster_state.update_delta_stats(); |
| 3239 | |
| 3240 | if (pending_service_map.epoch) { |
| 3241 | _prune_pending_service_map(); |
| 3242 | if (pending_service_map_dirty >= pending_service_map.epoch) { |
| 3243 | pending_service_map.modified = ceph_clock_now(); |
| 3244 | encode(pending_service_map, m->service_map_bl, CEPH_FEATURES_ALL); |
| 3245 | dout(10) << "sending service_map e" << pending_service_map.epoch |
| 3246 | << dendl; |
| 3247 | pending_service_map.epoch++; |
| 3248 | } |
| 3249 | } |
| 3250 | |
| 3251 | cluster_state.with_osdmap([&](const OSDMap& osdmap) { |
| 3252 | // FIXME: no easy way to get mon features here. this will do for |
| 3253 | // now, though, as long as we don't make a backward-incompat change. |
| 3254 | pg_map.encode_digest(osdmap, m->get_data(), CEPH_FEATURES_ALL); |
| 3255 | dout(10) << pg_map << dendl; |
| 3256 | |
| 3257 | pg_map.get_health_checks(g_ceph_context, osdmap, |
| 3258 | &m->health_checks); |
| 3259 | |
| 3260 | dout(10) << m->health_checks.checks.size() << " health checks" |
| 3261 | << dendl; |
| 3262 | dout(20) << "health checks:\n"; |
| 3263 | JSONFormatter jf(true); |
| 3264 | jf.dump_object("health_checks", m->health_checks); |
| 3265 | jf.flush(*_dout); |
| 3266 | *_dout << dendl; |
| 3267 | if (osdmap.require_osd_release >= ceph_release_t::luminous) { |
| 3268 | clog->debug() << "pgmap v" << pg_map.version << ": " << pg_map; |
| 3269 | } |
| 3270 | }); |
| 3271 | }); |
| 3272 | |
| 3273 | std::map<daemon_metric, unique_ptr<DaemonHealthMetricCollector>> accumulated; |
| 3274 | for (auto service : {"osd", "mon"} ) { |
nothing calls this directly
no test coverage detected