Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crm] syslog generation handling for single threshold for different b… #1056

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,18 @@ void CrmOrch::checkCrmThresholds()

for (auto &i : m_resourcesMap)
{
uint32_t maxUtilization = 0;
uint32_t maxUsedCounter = 0;
uint32_t maxAvailableCounter = 0;
uint32_t maxPercentageUtil = 0;
string threshType = "";
auto &res = i.second;

for (const auto &j : i.second.countersMap)
{
auto &cnt = j.second;
uint64_t utilization = 0;
uint32_t percentageUtil = 0;
string threshType = "";
uint32_t utilization = 0;

if (cnt.usedCounter != 0)
{
Expand All @@ -560,22 +564,28 @@ void CrmOrch::checkCrmThresholds()
default:
throw runtime_error("Unknown threshold type for CRM resource");
}

if ((utilization >= res.highThreshold) && (res.exceededLogCounter < CRM_EXCEEDED_MSG_MAX))
{
SWSS_LOG_WARN("%s THRESHOLD_EXCEEDED for %s %u%% Used count %u free count %u",
res.name.c_str(), threshType.c_str(), percentageUtil, cnt.usedCounter, cnt.availableCounter);

res.exceededLogCounter++;
}
else if ((utilization <= res.lowThreshold) && (res.exceededLogCounter > 0))
if (utilization >= maxUtilization)
{
SWSS_LOG_WARN("%s THRESHOLD_CLEAR for %s %u%% Used count %u free count %u",
res.name.c_str(), threshType.c_str(), percentageUtil, cnt.usedCounter, cnt.availableCounter);

res.exceededLogCounter = 0;
maxUtilization = utilization;
maxPercentageUtil = percentageUtil;
maxUsedCounter = cnt.usedCounter;
maxAvailableCounter = cnt.availableCounter;
}
} // end of counters loop
if ((maxUtilization >= res.highThreshold) && (res.exceededLogCounter < CRM_EXCEEDED_MSG_MAX))
{
SWSS_LOG_WARN("%s THRESHOLD_EXCEEDED for %s %u%% Used count %u free count %u",
res.name.c_str(), threshType.c_str(), maxPercentageUtil, maxUsedCounter, maxAvailableCounter);

res.exceededLogCounter++;
}
else if ((maxUtilization <= res.lowThreshold) && (res.exceededLogCounter > 0))
{
SWSS_LOG_WARN("%s THRESHOLD_CLEAR for %s %u%% Used count %u free count %u",
res.name.c_str(), threshType.c_str(), maxPercentageUtil, maxUsedCounter, maxAvailableCounter);

res.exceededLogCounter = 0;
}
} // end of resources loop
}

Expand Down