Skip to content

Commit

Permalink
Merge pull request #95 from rkoshak/threshAllAlerting
Browse files Browse the repository at this point in the history
Add all null and alerting Items in call to process rule
  • Loading branch information
rkoshak committed Mar 6, 2023
2 parents d98be9f + 66fba57 commit b6d279d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion rule-templates/thresholdAlert/newThresholdAlert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,21 @@ actions:
console.debug('Calling ' + ruleID + ' with alertItem=' + alertItem + ', alertState=' + state + ', isAlerting=' + isAlerting);
var gk = cache.private.get('gatekeeper', () => new gatekeeper.Gatekeeper());
gk.addCommand(GK_DELAY, () => {
rules.runRule(ruleID, { 'alertItem': alertItem, 'alertState': ''+state, 'isAlerting': isAlerting }, true);
try {
const allAlerting = items[group].members.filter(item => isAlertingState(stateToValue(item.state), stateToValue(thresholdStr)));
const alertingNames = allAlerting.map(item => item.label);
const nullItems = items[group].members.filter(item => item.state == 'NULL' || item.state == 'UNDEF');
const nullItemNames = nullItems.map(item => item.label);
rules.runRule(ruleID, {'alertItem': alertItem,
'alertState': ''+state,
'isAlerting': isAlerting,
'threshItems': allAlerting,
'threshItemLabels': alertingNames,
'nullItems': nullItems,
'nullItemLabels': nullItemNames}, true);
} catch(e) {
console.error('Error running rule ' + ruleID + '\n' + e);
}
});
}
Expand Down

0 comments on commit b6d279d

Please sign in to comment.