diff --git a/cmake/CliFboss2.cmake b/cmake/CliFboss2.cmake index 059cec3b44d4a..141594d77c773 100644 --- a/cmake/CliFboss2.cmake +++ b/cmake/CliFboss2.cmake @@ -392,7 +392,7 @@ add_executable(fboss2 fboss/cli/fboss2/commands/show/interface/counters/fec/CmdShowInterfaceCountersFec.h fboss/cli/fboss2/commands/show/interface/counters/fec/ber/CmdShowInterfaceCountersFecBer.h fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h - fboss/cli/fboss2/commands/show/interface/counters/fec/tail/CmdShowInterfaceCountersFecTail.h + fboss/cli/fboss2/commands/show/interface/counters/fec/tail/CmdShowInterfaceCountersFecTail.h fboss/cli/fboss2/commands/show/interface/counters/fec/histogram/CmdShowInterfaceCountersFecHistogram.h fboss/cli/fboss2/commands/show/interface/counters/mka/CmdShowInterfaceCountersMKA.h fboss/cli/fboss2/commands/show/interface/phy/CmdShowInterfacePhy.h diff --git a/fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h b/fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h index 035aa953eb2d9..d0b938ab609b7 100644 --- a/fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h +++ b/fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h @@ -57,9 +57,8 @@ class CmdShowInterfaceCountersFecUncorrectable qsfpClient->sync_getCounters(fb303CountersXPhyEgressUcSum); qsfpClient->sync_getCounters(fb303CountersTcvrEgressUcSum); #else - agentClient->sync_getRegexCounters( - fb303CountersIPhyIngressUcSum, - "^(eth|fab).*fec_uncorrectable_errors.sum.*"); + fb303CountersIPhyIngressUcSum = utils::getAgentFb303RegexCounters( + hostInfo, "^(eth|fab).*fec_uncorrectable_errors.sum.*"); qsfpClient->sync_getRegexCounters( fb303CountersXPhyIngressUcSum, ".*xphy.line.fec_uncorrectable.sum.*"); qsfpClient->sync_getRegexCounters( diff --git a/fboss/cli/fboss2/utils/CmdUtils.cpp b/fboss/cli/fboss2/utils/CmdUtils.cpp index f68912d3e68d9..8b8b886c537c5 100644 --- a/fboss/cli/fboss2/utils/CmdUtils.cpp +++ b/fboss/cli/fboss2/utils/CmdUtils.cpp @@ -395,4 +395,27 @@ std::map getFabricEndpoints( return entries; } +std::map getAgentFb303RegexCounters( + const HostInfo& hostInfo, + const std::string& regex) { + std::map counters; +#ifndef IS_OSS + // TODO: sync_getRegexCounters is not available in OSS + if (utils::isFbossFeatureEnabled(hostInfo.getName(), "multi_switch")) { + auto hwAgentQueryFn = + [&counters, + ®ex](apache::thrift::Client& client) { + std::map hwagentCounters; + client.sync_getRegexCounters(hwagentCounters, regex); + counters.merge(hwagentCounters); + }; + utils::runOnAllHwAgents(hostInfo, hwAgentQueryFn); + } else { + utils::createClient>(hostInfo) + ->sync_getRegexCounters(counters, regex); + } +#endif + return counters; +} + } // namespace facebook::fboss::utils diff --git a/fboss/cli/fboss2/utils/CmdUtils.h b/fboss/cli/fboss2/utils/CmdUtils.h index 69f6198af4a35..e4b0394953436 100644 --- a/fboss/cli/fboss2/utils/CmdUtils.h +++ b/fboss/cli/fboss2/utils/CmdUtils.h @@ -475,4 +475,8 @@ cfg::SwitchType getSwitchType( std::map getFabricEndpoints( const HostInfo& hostInfo); +std::map getAgentFb303RegexCounters( + const HostInfo& hostInfo, + const std::string& regex); + } // namespace facebook::fboss::utils