From 19ac3bb2289eb87d650bbe42b7a2e74870d355dd Mon Sep 17 00:00:00 2001 From: Massimo Candela Date: Tue, 10 Nov 2020 00:23:46 +0100 Subject: [PATCH] introduced noc group --- config.yml.example | 11 +++++++++-- docs/configuration.md | 4 +++- docs/prefixes.md | 31 ++++++++++++++++--------------- docs/usergroups.md | 9 ++++++--- src/env.js | 2 +- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/config.yml.example b/config.yml.example index 537cd01..1baf132 100644 --- a/config.yml.example +++ b/config.yml.example @@ -90,8 +90,10 @@ reports: # rejectUnauthorized: true # Reject unauthorized certificates # notifiedEmails: # default: +# - admin@example.org +# noc: # - joe@example.org -# - noc@example.org +# - seb@example.org # - file: reportSlack # channels: @@ -111,6 +113,7 @@ reports: # rpki: '#d892f0' # hooks: # default: _YOUR_SLACK_WEBHOOK_URL_ +# noc: _YOUR_SLACK_WEBHOOK_URL_ # - file: reportKafka # channels: @@ -167,6 +170,7 @@ reports: # visibility: "visibility::${prefix}@@${asn}" # urls: # default: _YOUR_ALERTA_API_URL_ +# noc: _YOUR_ALERTA_API_URL_ # - file: reportWebex # channels: @@ -179,6 +183,7 @@ reports: # params: # hooks: # default: _YOUR_WEBEX_WEBHOOK_URL_ +# noc: _YOUR_WEBEX_WEBHOOK_URL_ # - file: reportHTTP # channels: @@ -196,6 +201,7 @@ reports: # showPaths: 0 # Amount of AS_PATHs to report in the alert # hooks: # default: _YOUR_WEBHOOK_URL_ +# noc: _YOUR_WEBHOOK_URL_ # - file: reportTelegram # channels: @@ -210,6 +216,7 @@ reports: # botUrl: https://api.telegram.org/bot<_BOT_ID_>/sendMessage # chatIds: # default: _CHAT_ID_ +# noc: _CHAT_ID_ ############################ @@ -234,7 +241,7 @@ logging: useUTC: true checkForUpdatesAtBoot: true -generatePrefixListEveryDays: 2 +generatePrefixListEveryDays: 0 ############################ # Process monitoring settings: diff --git a/docs/configuration.md b/docs/configuration.md index 968d490..16a7674 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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 | |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 | -|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 | 2 | 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 | |rpki| A dictionary containing the RPKI configuration (see [here](rpki.md) for more details). | | | Yes | @@ -355,6 +355,8 @@ Parameters for this report module: This report module sends the alerts by email. +Read [here](context.md) how to write a template. + Parameters for this report module: |Parameter| Description| diff --git a/docs/prefixes.md b/docs/prefixes.md index 5c1ef2f..1b6a887 100644 --- a/docs/prefixes.md +++ b/docs/prefixes.md @@ -14,18 +14,19 @@ Below the list of possible parameters. **Remember to prepend them with a `--` in | Parameter | Description | Expected format | Example | Required | |---|---|---|---|---| -| -o | The YAML output file | A string ending in ".yml" | prefixes.yml | Yes | -| -a | The AS number(s) you want to generate the list for | A comma-separated list of integers | 2914,3333 | No (one among -a, -p, -l is required) | -| -e | Prefixes to exclude from the list | A comma-separated list of prefixes | 165.254.255.0/24,192.147.168.0/24 | No | -| -i | Avoid monitoring delegated prefixes. If a more specific prefix is found and it results announced by an AS different from the one declared in -a, then set `ignore: true` and `ignoreMorespecifics: true` | Nothing | | No -| -p | Prefixes for which the list will be generated | A comma-separated list of prefixes | 165.254.255.0/24,192.147.168.0/24 | No (one among -a, -p, -l is required) | -| -l | A file containing the prefixes for which the list will be generated | A text file having a prefix for each line | prefixes.txt | No (one among -a, -p, -l is required) | -| -s | A list of ASns to be monitored. See [monitorASns](#monitorASns) for more information | A comma separated list of integer | 2914,3333 | No | -| -m | Monitor all ASns which are origin of at least one of the monitored prefixes. This option is the same of `-s` except that the list of ASns is automatically generated by detecting the origin AS of all the monitored prefixes. See [monitorASns](#monitorASns) for more information | Nothing | | No | -| -x | HTTP/HTTPS proxy server to use | A string | http://username:password@proxy.example.org:8080 | No | +| -o | The YAML output file. | A string ending in ".yml" | prefixes.yml | Yes | +| -a | The AS number(s) you want to generate the list for. | A comma-separated list of integers | 2914,3333 | No (one among -a, -p, -l is required) | +| -e | Prefixes to exclude from the list. | A comma-separated list of prefixes | 165.254.255.0/24,192.147.168.0/24 | No | +| -i | Avoid monitoring delegated prefixes. If a more specific prefix is found and it results announced by an AS different from the one declared in -a, then set `ignore: true` and `ignoreMorespecifics: true`. | Nothing | | No +| -p | Prefixes for which the list will be generated. | A comma-separated list of prefixes | 165.254.255.0/24,192.147.168.0/24 | No (one among -a, -p, -l is required) | +| -l | A file containing the prefixes for which the list will be generated. | A text file having a prefix for each line | prefixes.txt | No (one among -a, -p, -l is required) | +| -s | A list of ASns to be monitored. See [monitorASns](#monitorASns) for more information. | A comma separated list of integer | 2914,3333 | No | +| -m | Monitor all ASns which are origin of at least one of the monitored prefixes. This option is the same of `-s` except that the list of ASns is automatically generated by detecting the origin AS of all the monitored prefixes. See [monitorASns](#monitorASns) for more information. | Nothing | | No | +| -x | HTTP/HTTPS proxy server to use. | A string | http://username:password@proxy.example.org:8080 | No | | -A | Append the new configuration to the old one. E.g. you can use this option to add another AS. | Nothing | | No | | -D | Enable debug mode. All queries executed in background will be shown. | Nothing | | No | | -H | Use historical visibility data for generating prefix list (prefixes visible in the last week). Useful in case the prefix generation process returns an empty dataset. | Nothing | | No | +| -g | The name of the user group that will be assigned to all the generated rules. See [here](usergroups.md). | A string | noc | No | ## Prefixes list fields @@ -63,14 +64,14 @@ Below the complete list of attributes (the dot notation is used to represent yml | Attribute | Description | Expected type | Required | |---|---|---|---| -| asn | The expected origin AS(es) of the prefix | An integer or an array of integers. | Yes | -| description | A description that will be reported in the alerts | A string | Yes | -| ignoreMorespecifics | Prefixes more specific of the current one will be excluded from monitoring | A boolean | Yes | -| ignore | Exclude the current prefix from monitoring. Useful when you are monitoring a prefix and you want to exclude a particular sub-prefix| A boolean | No | +| asn | The expected origin AS(es) of the prefix. | An integer or an array of integers. | Yes | +| description | A description that will be reported. in the alerts | A string | Yes | +| ignoreMorespecifics | Prefixes more specific of the current one will be excluded from monitoring. | A boolean | Yes | +| ignore | Exclude the current prefix from monitoring. Useful when you are monitoring a prefix and you want to exclude a particular sub-prefix. | A boolean | No | | includeMonitors | The list of monitors you want to run on this prefix. If this attribute is not declared, all monitors will be used. Not compatible with excludeMonitors. | An array of strings (monitors name according to config.yml) | No | -| excludeMonitors | The list of monitors you want to exclude on this prefix. Not compatible with includeMonitors. Use monitors `name` attributes, as defined in the monitor listy in [config.yml](https://github.com/nttgin/BGPalerter/blob/master/config.yml.example). | An array of strings (monitors name according to config.yml) | No | +| excludeMonitors | The list of monitors you want to exclude on this prefix. Not compatible with includeMonitors. Use monitors `name` attributes, as defined in the monitor list in [config.yml](https://github.com/nttgin/BGPalerter/blob/master/config.yml.example). | An array of strings (monitors name according to config.yml) | No | | path | A list path matching rules, read more [here](path-matching.md). | | No | -| group | The name of the group that will receive alerts about this monitored prefix. By default all alerts are sent to the "default" group. See [here](usergroups.md).| A string | No | +| group | The name of the group that will receive alerts about this monitored prefix. See [here](usergroups.md).| A string | No | ### Options entry diff --git a/docs/usergroups.md b/docs/usergroups.md index 3617ad2..44a51de 100644 --- a/docs/usergroups.md +++ b/docs/usergroups.md @@ -4,9 +4,12 @@ BGPalerter supports user groups. With user groups you can: * Notify only specific users about specific prefixes. * Notify only specific users about specific type of alerts. -By default all communications will use the default group, so it is not mandatory to configure any user group. -Note that the default group is used also for administrative and error communications. -Hence, it is important to set user groups in case you want to monitor resources of your customers and you want to forward to them the alerts without sending them administrative communications. +By default, BGPalerter creates two user groups `noc` and `default` (since v1.27.0). +* The `noc` user group receives only alerts related to the BGP monitoring. Even if set by default, this user group is optional. +* The `default` user group receives administrative and error communications. Additionally, it receives all the alerts that could not be dispatched to any other specific user group. This group is mandatory, and it MUST be set for all the report modules. + + +You can create how many user groups you wish, for example to monitor resources of your customers and forward them the alerts about their resources without sending them administrative communications. ## Notify only specific users about specific prefixes diff --git a/src/env.js b/src/env.js index 173daac..443d4a5 100644 --- a/src/env.js +++ b/src/env.js @@ -132,7 +132,7 @@ let config = { alarmOnlyOnce: false, monitoredPrefixesFiles: ["prefixes.yml"], persistStatus: true, - generatePrefixListEveryDays: 2, + generatePrefixListEveryDays: 0, logging: { directory: "logs", logRotatePattern: "YYYY-MM-DD",