}
auto m = new MMonMgrReport();
+ py_modules.get_health_checks(&m->health_checks);
+
cluster_state.with_pgmap([&](const PGMap& pg_map) {
cluster_state.update_delta_stats();
pg_map.get_health_checks(g_ceph_context, osdmap,
&m->health_checks);
+
dout(10) << m->health_checks.checks.size() << " health checks"
<< dendl;
dout(20) << "health checks:\n";
return r;
}
+void MgrPyModule::get_health_checks(health_check_map_t *checks)
+{
+ checks->merge(health_checks);
+}
#include "common/cmdparse.h"
#include "common/LogEntry.h"
+#include "common/Mutex.h"
+#include "mon/health_check.h"
#include <vector>
#include <string>
PyThreadState *pMainThreadState;
PyThreadState *pMyThreadState = nullptr;
+ health_check_map_t health_checks;
+
std::vector<ModuleCommand> commands;
int load_commands();
const cmdmap_t &cmdmap,
std::stringstream *ds,
std::stringstream *ss);
+
+ void set_health_checks(health_check_map_t&& c) {
+ health_checks = std::move(c);
+ }
+ void get_health_checks(health_check_map_t *checks);
};
std::string handle_pyerror();
{
_list_modules(g_conf->mgr_module_path, modules);
}
+
+void PyModules::set_health_checks(const std::string& handle,
+ health_check_map_t&& checks)
+{
+ Mutex::Locker l(lock);
+ auto p = modules.find(handle);
+ if (p != modules.end()) {
+ p->second->set_health_checks(std::move(checks));
+ }
+}
+
+void PyModules::get_health_checks(health_check_map_t *checks)
+{
+ Mutex::Locker l(lock);
+ for (auto& p : modules) {
+ p.second->get_health_checks(checks);
+ }
+}
#include "ClusterState.h"
class ServeThread;
+class health_check_map_t;
class PyModules
{
void set_config(const std::string &handle,
const std::string &key, const std::string &val);
+ void set_health_checks(const std::string& handle,
+ health_check_map_t&& checks);
+ void get_health_checks(health_check_map_t *checks);
+
void log(const std::string &handle,
int level, const std::string &record);