mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
simplified config file and changed some default values
This commit is contained in:
@@ -99,11 +99,9 @@ reports:
|
||||
# default: bgpalerter
|
||||
|
||||
|
||||
checkStaleNotificationsSeconds: 60
|
||||
notificationIntervalSeconds: 1800 # Repeat the same alert (which keeps being triggered) after x seconds
|
||||
clearNotificationQueueAfterSeconds: 1900 # Stop with the alert for an event which didn't happen again in x seconds
|
||||
notificationIntervalSeconds: 7200 # Repeat the same alert (which keeps being triggered) after x seconds
|
||||
|
||||
# The file containing the monitored prefixes. Please see prefixes.yml for an example
|
||||
# Below the files containing the monitored prefixes. Please see prefixes.yml for an example.
|
||||
# This is an array (use new lines and dashes!)
|
||||
monitoredPrefixesFiles:
|
||||
- prefixes.yml
|
||||
@@ -112,7 +110,7 @@ logging:
|
||||
directory: logs
|
||||
logRotatePattern: YYYY-MM-DD # Whenever the pattern changes, a new file is created and the old one rotated
|
||||
zippedArchive: true
|
||||
maxSize: 20m
|
||||
maxSize: 80m
|
||||
maxFiles: 14d
|
||||
|
||||
checkForUpdatesAtBoot: true
|
||||
checkForUpdatesAtBoot: true
|
6
env.js
6
env.js
@@ -106,15 +106,13 @@ let config = {
|
||||
channels: ["hijack", "newprefix", "visibility", "path"]
|
||||
}
|
||||
],
|
||||
checkStaleNotificationsSeconds : 60,
|
||||
notificationIntervalSeconds: 1800,
|
||||
clearNotificationQueueAfterSeconds: 1900,
|
||||
notificationIntervalSeconds: 7200,
|
||||
monitoredPrefixesFiles: ["prefixes.yml"],
|
||||
logging: {
|
||||
directory: "logs",
|
||||
logRotatePattern: "YYYY-MM-DD",
|
||||
zippedArchive: true,
|
||||
maxSize: "20m",
|
||||
maxSize: "80m",
|
||||
maxFiles: "14d",
|
||||
},
|
||||
checkForUpdatesAtBoot: true
|
||||
|
@@ -44,8 +44,14 @@ export default class Monitor {
|
||||
this.monitored = [];
|
||||
this.alerts = {};
|
||||
this.sent = {};
|
||||
|
||||
this.internalConfig = {
|
||||
notificationIntervalSeconds: this.config.notificationIntervalSeconds,
|
||||
checkStaleNotificationsSeconds: 60,
|
||||
clearNotificationQueueAfterSeconds: (this.config.notificationIntervalSeconds * 3) / 2
|
||||
};
|
||||
this.updateMonitoredPrefixes();
|
||||
setInterval(this._publish, this.config.checkStaleNotificationsSeconds * 1000)
|
||||
setInterval(this._publish, this.internalConfig.checkStaleNotificationsSeconds * 1000)
|
||||
};
|
||||
|
||||
updateMonitoredPrefixes = () => {
|
||||
@@ -129,7 +135,7 @@ export default class Monitor {
|
||||
|
||||
_clean = (group) => {
|
||||
|
||||
if (new Date().getTime() > group.latest + (this.config.clearNotificationQueueAfterSeconds * 1000)) {
|
||||
if (new Date().getTime() > group.latest + (this.internalConfig.clearNotificationQueueAfterSeconds * 1000)) {
|
||||
delete this.alerts[group.id];
|
||||
delete this.sent[group.id];
|
||||
|
||||
@@ -145,7 +151,7 @@ export default class Monitor {
|
||||
if (lastTimeSent) {
|
||||
|
||||
const isThereSomethingNew = lastTimeSent < group.latest;
|
||||
const isItTimeToSend = new Date().getTime() > lastTimeSent + (this.config.notificationIntervalSeconds * 1000);
|
||||
const isItTimeToSend = new Date().getTime() > lastTimeSent + (this.internalConfig.notificationIntervalSeconds * 1000);
|
||||
|
||||
return isThereSomethingNew && isItTimeToSend;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user