mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
fix only last array item considered for ASN monitoring (#404)
This commit is contained in:
@@ -20,7 +20,7 @@ The following are common parameters which it is possible to specify in the confi
|
|||||||
|httpProxy| Defines the HTTP/HTTPS proxy server to be used by BGPalerter and its submodules (reporters/connectors/monitors). See [here](http-proxy.md) for more information. | A string | http://usr:psw@ prxy.org:8080 | No |
|
|httpProxy| Defines the HTTP/HTTPS proxy server to be used by BGPalerter and its submodules (reporters/connectors/monitors). See [here](http-proxy.md) for more information. | A string | http://usr:psw@ prxy.org:8080 | No |
|
||||||
|volume| Defines a directory that will contain the data that needs persistence. For example, configuration files and logs will be created in such directory (default to "./"). | A string | /home/bgpalerter/ | No |
|
|volume| Defines a directory that will contain the data that needs persistence. For example, configuration files and logs will be created in such directory (default to "./"). | A string | /home/bgpalerter/ | No |
|
||||||
|persistStatus| If set to true, when BGPalerter is restarted the list of alerts already sent is recovered. This avoids duplicated alerts. The process must be able to write on disc inside `.cache/`. | A boolean | true | No |
|
|persistStatus| If set to true, when BGPalerter is restarted the list of alerts already sent is recovered. This avoids duplicated alerts. The process must be able to write on disc inside `.cache/`. | A boolean | true | No |
|
||||||
|generatePrefixListEveryDays| This parameter allows to automatically re-generate the prefix list after the specified amount of days. Set to 0 to disable it. | An integer | 0 | No |
|
|generatePrefixListEveryDays| This parameter allows to automatically re-generate the prefix list after the specified amount of days. Set to 0 to disable it. It works only if you have one prefix list file. | An integer | 0 | No |
|
||||||
|rpki| A dictionary containing the RPKI configuration (see [here](rpki.md) for more details). | | | Yes |
|
|rpki| A dictionary containing the RPKI configuration (see [here](rpki.md) for more details). | | | Yes |
|
||||||
|
|
||||||
|
|
||||||
|
@@ -64,7 +64,6 @@ export default class Input {
|
|||||||
});
|
});
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
this.setReGeneratePrefixList();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_isAlreadyContained = (prefix, lessSpecifics) => {
|
_isAlreadyContained = (prefix, lessSpecifics) => {
|
||||||
|
@@ -42,12 +42,14 @@ export default class InputYml extends Input {
|
|||||||
super(env);
|
super(env);
|
||||||
this.prefixes = [];
|
this.prefixes = [];
|
||||||
this.asns = [];
|
this.asns = [];
|
||||||
|
this.options = {};
|
||||||
|
this.watcherSet = false;
|
||||||
|
|
||||||
if (!this.config.monitoredPrefixesFiles || this.config.monitoredPrefixesFiles.length === 0) {
|
if (!this.config.monitoredPrefixesFiles || this.config.monitoredPrefixesFiles.length === 0) {
|
||||||
throw new Error("The monitoredPrefixesFiles key is missing in the config file");
|
throw new Error("The monitoredPrefixesFiles key is missing in the config file");
|
||||||
|
} else if (this.config.monitoredPrefixesFiles.length === 1) {
|
||||||
|
this.setReGeneratePrefixList();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.watcherSet = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loadPrefixes = () => {
|
loadPrefixes = () => {
|
||||||
@@ -115,10 +117,10 @@ export default class InputYml extends Input {
|
|||||||
if (this.validate(monitoredPrefixesFile)) {
|
if (this.validate(monitoredPrefixesFile)) {
|
||||||
if (monitoredPrefixesFile.options) {
|
if (monitoredPrefixesFile.options) {
|
||||||
|
|
||||||
this.options = monitoredPrefixesFile.options;
|
this.options = Object.assign(this.options, monitoredPrefixesFile.options);
|
||||||
|
|
||||||
if (monitoredPrefixesFile.options.monitorASns) {
|
if (monitoredPrefixesFile.options.monitorASns) {
|
||||||
this.asns = Object
|
const newAsnSet = Object
|
||||||
.keys(monitoredPrefixesFile.options.monitorASns)
|
.keys(monitoredPrefixesFile.options.monitorASns)
|
||||||
.map(asn => {
|
.map(asn => {
|
||||||
if (uniqueAsns[asn]) {
|
if (uniqueAsns[asn]) {
|
||||||
@@ -131,6 +133,8 @@ export default class InputYml extends Input {
|
|||||||
group: 'default'
|
group: 'default'
|
||||||
}, monitoredPrefixesFile.options.monitorASns[asn]);
|
}, monitoredPrefixesFile.options.monitorASns[asn]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.asns = this.asns.concat(newAsnSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +327,6 @@ export default class InputYml extends Input {
|
|||||||
if (rule.includeMonitors.length) prefixes[prefix].includeMonitors = rule.includeMonitors;
|
if (rule.includeMonitors.length) prefixes[prefix].includeMonitors = rule.includeMonitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const monitorASns = {};
|
const monitorASns = {};
|
||||||
for (let asnRule of this.asns) {
|
for (let asnRule of this.asns) {
|
||||||
monitorASns[asnRule.asn.getValue()] = {
|
monitorASns[asnRule.asn.getValue()] = {
|
||||||
|
Reference in New Issue
Block a user