#include "messages/MAuthReply.h"
#include "messages/MTimeCheck.h"
+#include "messages/MMonHealth.h"
#include "common/strtol.h"
#include "common/ceph_argparse.h"
#include "PGMonitor.h"
#include "LogMonitor.h"
#include "AuthMonitor.h"
+#include "mon/QuorumService.h"
+#include "mon/HealthMonitor.h"
#include "auth/AuthMethodList.h"
#include "auth/KeyRing.h"
paxos_service[PAXOS_LOG] = new LogMonitor(this, paxos, "logm");
paxos_service[PAXOS_AUTH] = new AuthMonitor(this, paxos, "auth");
+ health_monitor = QuorumServiceRef(new HealthMonitor(this));
+
mon_caps = new MonCaps();
mon_caps->set_allow_all(true);
mon_caps->text = "allow *";
}
init_paxos();
+ health_monitor->init();
// we need to bootstrap authentication keys so we can form an
// initial quorum.
// clean up
for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p)
(*p)->shutdown();
+ health_monitor->shutdown();
finish_contexts(g_ceph_context, waitfor_quorum, -ECANCELED);
finish_contexts(g_ceph_context, maybe_wait_for_quorum, -ECANCELED);
for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p)
(*p)->restart();
+ health_monitor->finish();
}
set<string> Monitor::get_sync_targets_names() {
paxos->leader_init();
for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p)
(*p)->election_finished();
+ health_monitor->start(epoch);
finish_election();
if (monmap->size() > 1)
paxos->peon_init();
for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p)
(*p)->election_finished();
+ health_monitor->start(epoch);
finish_election();
}
if (f)
f->close_section();
+ if (f)
+ health_monitor->get_health(f, (detailbl ? &detail : NULL));
+
stringstream fss;
fss << overall;
status = fss.str() + ss.str();
handle_timecheck(static_cast<MTimeCheck *>(m));
break;
+ case MSG_MON_HEALTH:
+ health_monitor->dispatch(static_cast<MMonHealth *>(m));
+ break;
+
default:
ret = false;
}
#include <memory>
#include <tr1/memory>
#include <errno.h>
+#include <boost/intrusive_ptr.hpp>
+// Because intusive_ptr clobbers our assert...
+#include "include/assert.h"
#define CEPH_MON_PROTOCOL 10 /* cluster internal */
l_cluster_last,
};
+class QuorumService;
class PaxosService;
class PerfCounters;
class MRoute;
class MForward;
class MTimeCheck;
+class MMonHealth;
#define COMPAT_SET_LOC "feature_set"
/**
* @}
*/
+ /**
+ * @defgroup Monitor_h_stats Keep track of monitor statistics
+ * @{
+ */
+ struct MonStatsEntry {
+ // data dir
+ uint64_t kb_total;
+ uint64_t kb_used;
+ uint64_t kb_avail;
+ unsigned int latest_avail_ratio;
+ utime_t last_update;
+ };
+
+ struct MonStats {
+ MonStatsEntry ours;
+ map<entity_inst_t,MonStatsEntry> others;
+ };
+
+ MonStats stats;
+ void stats_update();
+ /**
+ * @}
+ */
Context *probe_timeout_event; // for probing
friend class PGMonitor;
friend class LogMonitor;
+ boost::intrusive_ptr<QuorumService> health_monitor;
// -- sessions --
MonSessionMap session_map;