return f.get();
}
+PyObject *PyModules::get_daemon_status_python(
+ std::string const &handle,
+ const std::string &svc_name,
+ const std::string &svc_id)
+{
+ auto metadata = daemon_state.get(DaemonKey(svc_name, svc_id));
+ PyFormatter f;
+ for (const auto &i : metadata->service_status) {
+ f.dump_string(i.first.c_str(), i.second);
+ }
+ return f.get();
+}
PyObject *PyModules::get_python(const std::string &what)
{
PyObject *get_metadata_python(
std::string const &handle,
const std::string &svc_name, const std::string &svc_id);
+ PyObject *get_daemon_status_python(
+ std::string const &handle,
+ const std::string &svc_name, const std::string &svc_id);
PyObject *get_counter_python(
std::string const &handle,
const std::string &svc_name,
return global_handle->get_metadata_python(handle, svc_name, svc_id);
}
+static PyObject*
+get_daemon_status(PyObject *self, PyObject *args)
+{
+ char *handle = nullptr;
+ char *svc_name = NULL;
+ char *svc_id = NULL;
+ if (!PyArg_ParseTuple(args, "sss:get_daemon_status", &handle, &svc_name,
+ &svc_id)) {
+ return nullptr;
+ }
+ return global_handle->get_daemon_status_python(handle, svc_name, svc_id);
+}
+
static PyObject*
ceph_log(PyObject *self, PyObject *args)
{
"Get a server object"},
{"get_metadata", get_metadata, METH_VARARGS,
"Get a service's metadata"},
+ {"get_daemon_status", get_daemon_status, METH_VARARGS,
+ "Get a service's status"},
{"send_command", ceph_send_command, METH_VARARGS,
"Send a mon command"},
{"get_mgr_id", ceph_get_mgr_id, METH_NOARGS,
"""
return ceph_state.get_metadata(self._handle, svc_type, svc_id)
+ def get_daemon_status(self, svc_type, svc_id):
+ """
+ Fetch the latest status for a particular service daemon.
+
+ :param svc_type: string (e.g., 'rgw')
+ :param svc_id: string
+ :return: dict
+ """
+ return ceph_state.get_daemon_status(self._handle, svc_type, svc_id)
+
def send_command(self, *args, **kwargs):
"""
Called by the plugin to send a command to the mon