Skip to content

Commit 5f452e2

Browse files
committed
mon: Add leader indicator && stretch mode to ceph -s output
This commit enhances the ceph -s command output to display: The current leader monitor in the quorum status line with [leader: <mon-id>] format to provide immediate visibility into which monitor is making decisions The stretch mode status in the cluster section, showing stretch_mode: ENABLED when the cluster is operating in stretch mode. Example output: ``` cluster: id: e79711f4-0024-4737-83e0-5020f15cf7e0 stretch_mode: ENABLED health: HEALTH_OK services: mon: 3 daemons, quorum a,b,c (age 4m) [leader: a] ``` Fixes: https://tracker.ceph.com/issues/70406 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
1 parent 4b6aacc commit 5f452e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/mon/Monitor.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,7 +3106,9 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f,
31063106
} else {
31073107
ss << " cluster:\n";
31083108
ss << " id: " << monmap->get_fsid() << "\n";
3109-
3109+
if (is_stretch_mode()){
3110+
ss << " stretch_mode: ENABLED\n";
3111+
}
31103112
string health;
31113113
healthmon()->get_health_status(false, nullptr, &health,
31123114
"\n ", "\n ");
@@ -3139,7 +3141,8 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f,
31393141
const auto mon_count = monmap->mon_info.size();
31403142
auto mnow = ceph::mono_clock::now();
31413143
ss << " mon: " << spacing << mon_count << " daemons, quorum "
3142-
<< quorum_names << " (age " << timespan_str(mnow - quorum_since) << ")";
3144+
<< quorum_names << " (age " << timespan_str(mnow - quorum_since) << ")"
3145+
<< " [leader: " << get_leader_name() << "]";
31433146
if (quorum_names.size() != mon_count) {
31443147
std::list<std::string> out_of_q;
31453148
for (size_t i = 0; i < monmap->ranks.size(); ++i) {

0 commit comments

Comments
 (0)