mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
improved skipPrefixMatch and renamed skipPrefixMatchOnDifferentGroups
This commit is contained in:
@@ -46,7 +46,7 @@ monitors:
|
|||||||
channel: misconfiguration
|
channel: misconfiguration
|
||||||
name: asn-monitor
|
name: asn-monitor
|
||||||
params:
|
params:
|
||||||
skipPrefixMatch: false
|
skipPrefixMatchOnDifferentGroups: false
|
||||||
thresholdMinPeers: 3
|
thresholdMinPeers: 3
|
||||||
|
|
||||||
- file: monitorRPKI
|
- file: monitorRPKI
|
||||||
|
@@ -68,7 +68,7 @@ export default class Config {
|
|||||||
channel: "misconfiguration",
|
channel: "misconfiguration",
|
||||||
name: "asn-monitor",
|
name: "asn-monitor",
|
||||||
params: {
|
params: {
|
||||||
skipPrefixMatch: false,
|
skipPrefixMatchOnDifferentGroups: false,
|
||||||
thresholdMinPeers: 3
|
thresholdMinPeers: 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -37,7 +37,7 @@ export default class MonitorAS extends Monitor {
|
|||||||
constructor(name, channel, params, env, input){
|
constructor(name, channel, params, env, input){
|
||||||
super(name, channel, params, env, input);
|
super(name, channel, params, env, input);
|
||||||
this.thresholdMinPeers = (params && params.thresholdMinPeers != null) ? params.thresholdMinPeers : 3;
|
this.thresholdMinPeers = (params && params.thresholdMinPeers != null) ? params.thresholdMinPeers : 3;
|
||||||
this.skipPrefixMatch = !!params?.skipPrefixMatch;
|
this.skipPrefixMatchOnDifferentGroups = !!params?.skipPrefixMatchOnDifferentGroups;
|
||||||
this.updateMonitoredResources();
|
this.updateMonitoredResources();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,7 +86,11 @@ export default class MonitorAS extends Monitor {
|
|||||||
|
|
||||||
const matchedPrefixRule = this.getMoreSpecificMatch(messagePrefix, true);
|
const matchedPrefixRule = this.getMoreSpecificMatch(messagePrefix, true);
|
||||||
|
|
||||||
if (this.skipPrefixMatch || !matchedPrefixRule) {
|
const groupsUnion = [...new Set([...matchedRule.group, ...matchedPrefixRule.group])];
|
||||||
|
const differentGroups = this.skipPrefixMatchOnDifferentGroups
|
||||||
|
&& (groupsUnion.length !== matchedRule.group.length || groupsUnion.length !== matchedPrefixRule.group);
|
||||||
|
|
||||||
|
if (differentGroups || !matchedPrefixRule) {
|
||||||
this.publishAlert(messageOrigin.getId().toString() + "-" + messagePrefix,
|
this.publishAlert(messageOrigin.getId().toString() + "-" + messagePrefix,
|
||||||
messageOrigin.getId(),
|
messageOrigin.getId(),
|
||||||
matchedRule,
|
matchedRule,
|
||||||
|
Reference in New Issue
Block a user