{
size_t maxlen = 3;
auto& service_map = mgrstatmon()->get_service_map();
- std::map<std::string, std::set<std::string>> nvmeof_groups;
+ std::map<NvmeGroupKey, std::set<std::string>> nvmeof_services;
for (auto& p : service_map.services) {
if (p.first == "nvmeof") {
auto daemons = p.second.daemons;
for (auto& d : daemons) {
auto group = d.second.metadata.find("group");
- auto gw_id = d.second.metadata.find("id");
- nvmeof_groups[group->second].insert(gw_id->second);
- maxlen = std::max(maxlen, p.first.size() + group->second.size() + 3);
+ auto pool = d.second.metadata.find("pool_name");
+ auto gw_id = d.second.metadata.find("id");
+ NvmeGroupKey group_key = std::make_pair(pool->second, group->second);
+ nvmeof_services[group_key].insert(gw_id->second);
+ maxlen = std::max(maxlen,
+ p.first.size() + group->second.size() + pool->second.size() + 4
+ ); // nvmeof (pool.group):
}
} else {
maxlen = std::max(maxlen, p.first.size());
continue;
}
if (p.first == "nvmeof") {
- for (auto& group : nvmeof_groups) {
- ss << " " << p.first << " (" << group.first << "): ";
- ss << string(maxlen - p.first.size() - group.first.size() - 3, ' ');
- ss << group.second.size() << " gateway" << (group.second.size() ? "s" : "") << " active (";
- for (auto gw = group.second.begin(); gw != group.second.end(); ++gw){
- if (gw != group.second.begin()) {
+ auto created_gws = nvmegwmon()->get_map().created_gws;
+ for (const auto& created_map_pair: created_gws) {
+ const auto& group_key = created_map_pair.first;
+ const NvmeGwMonStates& gw_created_map = created_map_pair.second;
+ const int total = gw_created_map.size();
+ auto& active_gws = nvmeof_services[group_key];
+
+ ss << " " << p.first << " (" << group_key.first << "." << group_key.second << "): ";
+ ss << string(maxlen - p.first.size() - group_key.first.size()
+ - group_key.second.size() - 4, ' ');
+ ss << total << " gateway" << (total > 1 ? "s" : "") << ": "
+ << active_gws.size() << " active (";
+ for (auto gw = active_gws.begin(); gw != active_gws.end(); ++gw){
+ if (gw != active_gws.begin()) {
ss << ", ";
}
ss << *gw;