convert *max/min_counter to *max/min_event_counter

this is the default behavior
This commit is contained in:
Radu Ioan Fericean
2015-11-03 18:43:12 +02:00
parent 233b4b0b4a
commit 1f20539bb3
4 changed files with 13 additions and 2 deletions

View File

@@ -226,6 +226,10 @@ func (mig MigratorRC8) migrateAccounts() error {
MinQueuedItems: oldAtr.MinQueuedItems,
Executed: oldAtr.Executed,
}
if newAcc.ActionTriggers[index].ThresholdType == "*min_counter" ||
newAcc.ActionTriggers[index].ThresholdType == "*max_counter" {
newAcc.ActionTriggers[index].ThresholdType = strings.Replace(newAcc.ActionTriggers[index].ThresholdType, "_", "_event_", 1)
}
}
newAccounts[keyIndex] = newAcc
}
@@ -286,6 +290,10 @@ func (mig MigratorRC8) migrateActionTriggers() error {
MinQueuedItems: oldAtr.MinQueuedItems,
Executed: oldAtr.Executed,
}
if newAtrs[index].ThresholdType == "*min_counter" ||
newAtrs[index].ThresholdType == "*max_counter" {
newAtrs[index].ThresholdType = strings.Replace(newAtrs[index].ThresholdType, "_", "_event_", 1)
}
}
newAtrsMap[key] = newAtrs
}

View File

@@ -1,7 +1,7 @@
#Tag[0],UniqueId[1],ThresholdType[2],ThresholdValue[3],Recurrent[4],MinSleep[5],BalanceTag[6],BalanceType[7],BalanceDirections[8],BalanceCategories[9],BalanceDestinationTags[10],BalanceRatingSubject[11],BalanceSharedGroup[12],BalanceExpiryTime[13],BalanceTimingTags[14],BalanceWeight[15],BalanceDisabled[16],StatsMinQueuedItems[17],ActionsTag[18],Weight[19]
STANDARD_TRIGGERS,,*min_balance,2,false,0,,*monetary,*out,,,,,,,,,,LOG_BALANCE,10
STANDARD_TRIGGERS,,*max_balance,20,false,0,,*monetary,*out,,,,,,,,,,LOG_BALANCE,10
STANDARD_TRIGGERS,,*max_counter,15,false,0,,*monetary,*out,,FS_USERS,,,,,,,,LOG_BALANCE,10
STANDARD_TRIGGERS,,*max_event_counter,15,false,0,,*monetary,*out,,FS_USERS,,,,,,,,LOG_BALANCE,10
CDRST1_WARN_ASR,,*min_asr,45,true,1h,,,,,,,,,,,,3,CDRST_WARN_HTTP,10
CDRST1_WARN_ACD,,*min_acd,10,true,1h,,,,,,,,,,,,5,CDRST_WARN_HTTP,10
CDRST1_WARN_ACC,,*max_acc,10,true,10m,,,,,,,,,,,,5,CDRST_WARN_HTTP,10
1 #Tag[0] UniqueId[1] ThresholdType[2] ThresholdValue[3] Recurrent[4] MinSleep[5] BalanceTag[6] BalanceType[7] BalanceDirections[8] BalanceCategories[9] BalanceDestinationTags[10] BalanceRatingSubject[11] BalanceSharedGroup[12] BalanceExpiryTime[13] BalanceTimingTags[14] BalanceWeight[15] BalanceDisabled[16] StatsMinQueuedItems[17] ActionsTag[18] Weight[19]
2 STANDARD_TRIGGERS *min_balance 2 false 0 *monetary *out LOG_BALANCE 10
3 STANDARD_TRIGGERS *max_balance 20 false 0 *monetary *out LOG_BALANCE 10
4 STANDARD_TRIGGERS *max_counter *max_event_counter 15 false 0 *monetary *out FS_USERS LOG_BALANCE 10
5 CDRST1_WARN_ASR *min_asr 45 true 1h 3 CDRST_WARN_HTTP 10
6 CDRST1_WARN_ACD *min_acd 10 true 1h 5 CDRST_WARN_HTTP 10
7 CDRST1_WARN_ACC *max_acc 10 true 10m 5 CDRST_WARN_HTTP 10

View File

@@ -1,6 +1,6 @@
#Tag[0],UniqueId[1],ThresholdType[2],ThresholdValue[3],Recurrent[4],MinSleep[5],BalanceTag[6],BalanceType[7],BalanceDirections[8],BalanceCategories[9],BalanceDestinationIds[10],BalanceRatingSubject[11],BalanceSharedGroup[12],BalanceExpiryTime[13],BalanceTimingIds[14],BalanceWeight[15],BalanceDisabled[16],StatsMinQueuedItems[17],ActionsId[18],Weight[19]
STANDARD_TRIGGERS,,*min_balance,2,false,0,,*monetary,*out,,,,,,,,,,LOG_WARNING,10
STANDARD_TRIGGERS,,*max_counter,5,false,0,,*monetary,*out,,FS_USERS,,,,,,,,LOG_WARNING,10
STANDARD_TRIGGERS,,*max_event_counter,5,false,0,,*monetary,*out,,FS_USERS,,,,,,,,LOG_WARNING,10
STANDARD_TRIGGERS,,*max_balance,20,false,0,,*monetary,*out,,,,,,,,,,LOG_WARNING,10
STANDARD_TRIGGERS,,*max_balance,100,false,0,,*monetary,*out,,,,,,,,,,DISABLE_AND_LOG,10
CDRST1_WARN,,*min_asr,45,true,1m,,,,,,,,,,,,3,LOG_WARNING,10
1 #Tag[0] UniqueId[1] ThresholdType[2] ThresholdValue[3] Recurrent[4] MinSleep[5] BalanceTag[6] BalanceType[7] BalanceDirections[8] BalanceCategories[9] BalanceDestinationIds[10] BalanceRatingSubject[11] BalanceSharedGroup[12] BalanceExpiryTime[13] BalanceTimingIds[14] BalanceWeight[15] BalanceDisabled[16] StatsMinQueuedItems[17] ActionsId[18] Weight[19]
2 STANDARD_TRIGGERS *min_balance 2 false 0 *monetary *out LOG_WARNING 10
3 STANDARD_TRIGGERS *max_counter *max_event_counter 5 false 0 *monetary *out FS_USERS LOG_WARNING 10
4 STANDARD_TRIGGERS *max_balance 20 false 0 *monetary *out LOG_WARNING 10
5 STANDARD_TRIGGERS *max_balance 100 false 0 *monetary *out DISABLE_AND_LOG 10
6 CDRST1_WARN *min_asr 45 true 1m 3 LOG_WARNING 10

View File

@@ -570,6 +570,9 @@ func (acc *Account) InitCounters() {
continue
}
_, ct, _ := at.GetThresholdTypeInfo()
if ct == "" {
ct = utils.COUNTER_EVENT
}
uc, exists := ucTempMap[at.BalanceType+ct]
if !exists {
uc = &UnitCounter{