1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

split channels for rpki and roa monitoring

This commit is contained in:
Massimo Candela
2022-01-28 16:44:00 +01:00
parent eb6972f545
commit f6e0e5a70d
6 changed files with 37 additions and 12 deletions

View File

@@ -56,7 +56,7 @@ monitors:
checkDisappearing: false
- file: monitorROAS
channel: rpki
channel: roa
name: rpki-diff
params:
enableDiffAlerts: true
@@ -83,6 +83,7 @@ reports:
- path
- misconfiguration
- rpki
- roa
params:
persistAlertData: false
alertDataDirectory: alertdata/
@@ -95,6 +96,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# showPaths: 5 # Amount of AS_PATHs to report in the alert
# senderEmail: bgpalerter@xxxx
@@ -127,6 +129,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# showPaths: 0 # Amount of AS_PATHs to report in the alert
# colors:
@@ -135,6 +138,7 @@ reports:
# visibility: '#fad648'
# path: '#42cbf5'
# rpki: '#d892f0'
# roa: '#d892f0'
# hooks:
# default: _YOUR_SLACK_WEBHOOK_URL_
# noc: _YOUR_SLACK_WEBHOOK_URL_
@@ -147,6 +151,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# host: localhost
# port: 9092
@@ -162,6 +167,7 @@ reports:
# - asn-monitor
# - misconfiguration
# - rpki
# - roa
# params:
# host: 127.0.0.1
# port: 514
@@ -181,6 +187,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# severity:
# hijack: critical
@@ -204,6 +211,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# hooks:
# default: _YOUR_WEBEX_WEBHOOK_URL_
@@ -217,6 +225,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# templates: # See here how to write a template https://github.com/nttgin/BGPalerter/blob/main/docs/context.md
# default: '{"text": "${summary}"}'
@@ -235,6 +244,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# showPaths: 0 # Amount of AS_PATHs to report in the alert
# botUrl: https://api.telegram.org/bot<_BOT_ID_>/sendMessage
@@ -250,6 +260,7 @@ reports:
# - path
# - misconfiguration
# - rpki
# - roa
# params:
# maxAlertsAmount: 25

View File

@@ -121,7 +121,7 @@ When event started: ${earliest} UTC\n\
Last event: ${latest} UTC\n\
See: ${rpkiLink}';
const templateRoas = '${summary}\n\
const templateRoa = '${summary}\n\
\n\
\n\
DETAILS:\n\
@@ -168,7 +168,7 @@ export default class emailTemplates {
},
{
channel: 'roa',
content: templateRoas
content: templateRoa
}
];

View File

@@ -75,8 +75,10 @@ export default class Report {
};
getRpkiLink = (prefix, asn) => {
asn = asn && asn.getValue() || [];
asn = (Array.isArray(asn)) ? [] : [asn];
return brembo.build("https://rpki.massimocandela.com/", {
path: ["#", prefix, asn],
path: ["#", prefix].concat(asn),
params: {
"sources": RpkiValidator.providers.join(",")
}
@@ -91,6 +93,10 @@ export default class Report {
latest: moment(content.latest).utc().format("YYYY-MM-DD HH:mm:ss"),
channel,
type: content.origin,
bgplay: "",
rpkiLink: "",
slackUrl: "",
markDownUrl: ""
};
let matched = null;
@@ -170,10 +176,12 @@ export default class Report {
context.asn = (matched.asn || "").toString();
context.prefix = matched.prefix || content.data[0].matchedMessage.prefix;
context.description = matched.description || "";
context.neworigin = content.data[0].matchedMessage.originAS;
context.newprefix = content.data[0].matchedMessage.prefix;
context.bgplay = this.getBGPlayLink(matched.prefix, content.earliest, content.latest);
context.rpkiLink = this.getRpkiLink(context.prefix, context.asn);
context.slackUrl = `[<${context.rpkiLink}|See>]`;
context.markDownUrl = `[[see](${context.rpkiLink})]`;
context.rpkiLink = this.getRpkiLink(context.newprefix, context.neworigin);
context.slackUrl = ` [<${context.rpkiLink}|see>]`;
context.markDownUrl = ` [[see](${context.rpkiLink})]`;
break;
case "roa":

View File

@@ -164,8 +164,8 @@ describe("Core functions", function() {
expect(config.monitors[6]).to
.containSubset({
"channel": "rpki",
"name": "rpki-monitor"
"channel": "roa",
"name": "roa-diff"
});
expect(config.monitors[config.monitors.length - 1]).to
@@ -186,7 +186,11 @@ describe("Core functions", function() {
"channels": [
"hijack",
"newprefix",
"visibility"
"visibility",
"rpki",
"roa",
"misconfiguration",
"path"
],
"params": {}
});

View File

@@ -45,8 +45,8 @@ monitors:
checkUncovered: true
- file: monitorROAS
channel: rpki
name: rpki-monitor
channel: roa
name: roa-diff
reports:
- file: reportFile
@@ -57,6 +57,7 @@ reports:
- path
- misconfiguration
- rpki
- roa
params:
persistAlertData: false
alertDataDirectory: alertdata/
@@ -69,6 +70,7 @@ reports:
- path
- misconfiguration
- rpki
- roa
params:
maxAlertsAmount: 100