From: Sage Weil Date: Wed, 29 Jan 2020 21:37:03 +0000 (-0600) Subject: mon: dump json from 'sessions' asok/tell command X-Git-Tag: v15.1.1~594^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=71a0d8a568bd0034cc1e6329cd20269f11635697;p=ceph.git mon: dump json from 'sessions' asok/tell command Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index bb4abfd3d234..807dcb27114a 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -340,7 +340,7 @@ int Monitor::do_admin_command( } else if (command == "sessions") { f->open_array_section("sessions"); for (auto p : session_map.sessions) { - f->dump_stream("session") << *p; + f->dump_object("session", *p); } f->close_section(); } else if (command == "dump_historic_ops") { diff --git a/src/mon/Session.h b/src/mon/Session.h index cf0de07e4e6b..3d190ae26023 100644 --- a/src/mon/Session.h +++ b/src/mon/Session.h @@ -109,6 +109,23 @@ struct MonSession : public RefCountedObject { const entity_addr_t& get_peer_socket_addr() { return socket_addr; } + + void dump(Formatter *f) const { + f->dump_stream("name") << name; + f->dump_stream("entity_name") << entity_name; + f->dump_object("addrs", addrs); + f->dump_object("socket_addr", socket_addr); + f->dump_string("con_type", ceph_entity_type_name(con_type)); + f->dump_unsigned("con_features", con_features); + f->dump_stream("con_features_hex") << std::hex << con_features << std::dec; + f->dump_string("con_features_release", + ceph_release_name(ceph_release_from_features(con_features))); + f->dump_bool("open", !closed); + f->dump_object("caps", caps); + f->dump_bool("authenticated", authenticated); + f->dump_unsigned("osd_epoch", osd_epoch); + f->dump_string("remote_host", remote_host); + } };