mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
introduced TA-specific tolerance (#1204)
This commit is contained in:
@@ -68,8 +68,18 @@ monitors:
|
|||||||
enableAdvancedRpkiStats: false
|
enableAdvancedRpkiStats: false
|
||||||
roaExpirationAlertHours: 2
|
roaExpirationAlertHours: 2
|
||||||
checkOnlyASns: true
|
checkOnlyASns: true
|
||||||
toleranceDeletedRoasTA: 20
|
toleranceDeletedRoasTA:
|
||||||
toleranceExpiredRoasTA: 20
|
ripe: 20
|
||||||
|
apnic: 20
|
||||||
|
arin: 20
|
||||||
|
lacnic: 20
|
||||||
|
afrinic: 50
|
||||||
|
toleranceExpiredRoasTA:
|
||||||
|
ripe: 20
|
||||||
|
apnic: 20
|
||||||
|
arin: 20
|
||||||
|
lacnic: 20
|
||||||
|
afrinic: 50
|
||||||
|
|
||||||
- file: monitorPathNeighbors
|
- file: monitorPathNeighbors
|
||||||
channel: path
|
channel: path
|
||||||
|
@@ -94,8 +94,20 @@ export default class Config {
|
|||||||
enableAdvancedRpkiStats: false,
|
enableAdvancedRpkiStats: false,
|
||||||
roaExpirationAlertHours: 2,
|
roaExpirationAlertHours: 2,
|
||||||
checkOnlyASns: true,
|
checkOnlyASns: true,
|
||||||
toleranceDeletedRoasTA: 20,
|
toleranceDeletedRoasTA: {
|
||||||
toleranceExpiredRoasTA: 20
|
ripe: 20,
|
||||||
|
apnic: 20,
|
||||||
|
arin: 20,
|
||||||
|
lacnic: 20,
|
||||||
|
afrinic: 50
|
||||||
|
},
|
||||||
|
toleranceExpiredRoasTA: {
|
||||||
|
ripe: 20,
|
||||||
|
apnic: 20,
|
||||||
|
arin: 20,
|
||||||
|
lacnic: 20,
|
||||||
|
afrinic: 50
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -6,6 +6,20 @@ import moment from "moment";
|
|||||||
import ipUtils from "ip-sub";
|
import ipUtils from "ip-sub";
|
||||||
import batchPromises from "batch-promises";
|
import batchPromises from "batch-promises";
|
||||||
|
|
||||||
|
const getTaToleranceDict = (tolerance) => {
|
||||||
|
if (typeof(tolerance) === "number") {
|
||||||
|
return {
|
||||||
|
ripe: tolerance,
|
||||||
|
apnic: tolerance,
|
||||||
|
arin: tolerance,
|
||||||
|
lacnic: tolerance,
|
||||||
|
afrinic: tolerance
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tolerance;
|
||||||
|
}
|
||||||
|
|
||||||
export default class MonitorROAS extends Monitor {
|
export default class MonitorROAS extends Monitor {
|
||||||
|
|
||||||
constructor(name, channel, params, env, input){
|
constructor(name, channel, params, env, input){
|
||||||
@@ -25,8 +39,8 @@ export default class MonitorROAS extends Monitor {
|
|||||||
this.roaExpirationAlertHours = params.roaExpirationAlertHours || 2;
|
this.roaExpirationAlertHours = params.roaExpirationAlertHours || 2;
|
||||||
this.checkOnlyASns = params.checkOnlyASns != null ? params.checkOnlyASns : true;
|
this.checkOnlyASns = params.checkOnlyASns != null ? params.checkOnlyASns : true;
|
||||||
|
|
||||||
this.toleranceExpiredRoasTA = params.toleranceExpiredRoasTA || 20;
|
this.toleranceExpiredRoasTA = getTaToleranceDict(params.toleranceExpiredRoasTA || 20);
|
||||||
this.toleranceDeletedRoasTA = params.toleranceDeletedRoasTA || 20;
|
this.toleranceDeletedRoasTA = getTaToleranceDict(params.toleranceDeletedRoasTA || 20);
|
||||||
this.timesDeletedTAs = {};
|
this.timesDeletedTAs = {};
|
||||||
this.seenTAs = {};
|
this.seenTAs = {};
|
||||||
this.monitored = {
|
this.monitored = {
|
||||||
@@ -84,7 +98,7 @@ export default class MonitorROAS extends Monitor {
|
|||||||
const diff = max - min;
|
const diff = max - min;
|
||||||
const percentage = 100 / max * diff;
|
const percentage = 100 / max * diff;
|
||||||
|
|
||||||
if (percentage > this.toleranceDeletedRoasTA) {
|
if (percentage > this.toleranceDeletedRoasTA[ta]) {
|
||||||
const message = `Possible TA malfunction or incomplete VRP file: ${percentage.toFixed(2)}% of the ROAs disappeared from ${ta}`;
|
const message = `Possible TA malfunction or incomplete VRP file: ${percentage.toFixed(2)}% of the ROAs disappeared from ${ta}`;
|
||||||
|
|
||||||
this.publishAlert(`disappeared-${ta}`,
|
this.publishAlert(`disappeared-${ta}`,
|
||||||
@@ -115,7 +129,7 @@ export default class MonitorROAS extends Monitor {
|
|||||||
const max = sizes[ta];
|
const max = sizes[ta];
|
||||||
const percentage = (100 / max) * min;
|
const percentage = (100 / max) * min;
|
||||||
|
|
||||||
if (percentage > this.toleranceExpiredRoasTA) {
|
if (percentage > this.toleranceExpiredRoasTA[ta]) {
|
||||||
const currentTaVrps = vrps.filter(i => i.ta === ta);
|
const currentTaVrps = vrps.filter(i => i.ta === ta);
|
||||||
this._getExpiringItems(currentTaVrps)
|
this._getExpiringItems(currentTaVrps)
|
||||||
.then(extra => {
|
.then(extra => {
|
||||||
|
Reference in New Issue
Block a user