@@ -340,13 +340,18 @@ void CrmOrch::handleSetCommand(const string& key, const vector<FieldValueTuple>&
340
340
}
341
341
else if (crmThreshTypeResMap.find (field) != crmThreshTypeResMap.end ())
342
342
{
343
- auto resourceType = crmThreshTypeResMap.at (field);
344
343
auto thresholdType = crmThreshTypeMap.at (value);
344
+ auto resourceType = crmThreshTypeResMap.at (field);
345
+ auto &resource = m_resourcesMap.at (resourceType);
345
346
346
- if (m_resourcesMap. at (resourceType) .thresholdType != thresholdType)
347
+ if (resource .thresholdType != thresholdType)
347
348
{
348
- m_resourcesMap.at (resourceType).thresholdType = thresholdType;
349
- m_resourcesMap.at (resourceType).exceededLogCounter = 0 ;
349
+ resource.thresholdType = thresholdType;
350
+
351
+ for (auto &cnt : resource.countersMap )
352
+ {
353
+ cnt.second .exceededLogCounter = 0 ;
354
+ }
350
355
}
351
356
}
352
357
else if (crmThreshLowResMap.find (field) != crmThreshLowResMap.end ())
@@ -723,7 +728,7 @@ void CrmOrch::checkCrmThresholds()
723
728
{
724
729
auto &res = i.second ;
725
730
726
- for (const auto &j : i.second .countersMap )
731
+ for (auto &j : i.second .countersMap )
727
732
{
728
733
auto &cnt = j.second ;
729
734
uint64_t utilization = 0 ;
@@ -762,7 +767,7 @@ void CrmOrch::checkCrmThresholds()
762
767
throw runtime_error (" Unknown threshold type for CRM resource" );
763
768
}
764
769
765
- if ((utilization >= res.highThreshold ) && (res .exceededLogCounter < CRM_EXCEEDED_MSG_MAX))
770
+ if ((utilization >= res.highThreshold ) && (cnt .exceededLogCounter < CRM_EXCEEDED_MSG_MAX))
766
771
{
767
772
event_params_t params = {
768
773
{ " percent" , to_string (percentageUtil) },
@@ -773,14 +778,14 @@ void CrmOrch::checkCrmThresholds()
773
778
res.name .c_str (), threshType.c_str (), percentageUtil, cnt.usedCounter , cnt.availableCounter );
774
779
775
780
event_publish (g_events_handle, " chk_crm_threshold" , ¶ms);
776
- res .exceededLogCounter ++;
781
+ cnt .exceededLogCounter ++;
777
782
}
778
- else if ((utilization <= res.lowThreshold ) && (res .exceededLogCounter > 0 ) && (res.highThreshold != res.lowThreshold ))
783
+ else if ((utilization <= res.lowThreshold ) && (cnt .exceededLogCounter > 0 ) && (res.highThreshold != res.lowThreshold ))
779
784
{
780
785
SWSS_LOG_WARN (" %s THRESHOLD_CLEAR for %s %u%% Used count %u free count %u" ,
781
786
res.name .c_str (), threshType.c_str (), percentageUtil, cnt.usedCounter , cnt.availableCounter );
782
787
783
- res .exceededLogCounter = 0 ;
788
+ cnt .exceededLogCounter = 0 ;
784
789
}
785
790
} // end of counters loop
786
791
} // end of resources loop
0 commit comments