2019-07-15 10:36:01 +00:00
# BGPalerter
## TL;DR
2019-08-14 13:08:14 +02:00
1. Download the executable from [`bin/` ](https://github.com/nttgin/BGPalerter/tree/master/bin ) (be sure to select the one for your OS)
2019-07-15 10:36:01 +00:00
2019-08-14 13:08:14 +02:00
2. Download [`config.yml` ](https://github.com/nttgin/BGPalerter/blob/master/config.yml ) and [`prefixes.yml` ](https://github.com/nttgin/BGPalerter/blob/master/prefixes.yml ) and place them in the same directory of the executable
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
3. Modify `prefixes.yml` and add the prefixes you want to monitor
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
4. Run the executable
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
5. See the alerts in `logs/reports-YYYY-MM-DD.log`
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
In `config.yml` you can find other reporting mechanisms (e.g. email and slack) in addition to logging on files.
2019-08-14 13:12:36 +02:00
Please uncomment the related section and configure accordingly to your needs.
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
## More information for users
2019-07-15 10:36:01 +00:00
### Composition
You can compose the tool with 3 main components: connectors, monitors, and reports.
Connectors retrieve/listen the data from different sources and transform them in a common format.
Monitors analize the data flow and produce alerts. Different monitors try to detect different issues.
Reports send/store the alerts, e.g. by email or to a file.
##### connectors
Possible connectors are:
2019-08-14 12:58:28 +02:00
* _connectorRIS_, for real-time data from RIPE RIS (https://ris-live.ripe.net/)
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* _connectorTest_, for testing purposes, it provokes all types of alerting
2019-07-15 10:36:01 +00:00
##### monitors
Possible monitors are:
2019-08-14 12:58:28 +02:00
* _monitorHijack_, for monitoring hijacks
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* _monitorVisibility_, for monitoring prefixes visibility (you will get notified when withdrawals make monitored routes disappear). A threshold can be specified in config.yml to trigger an alert only if the issue is visible from a certain amount of peers.
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* _monitorNewPrefix_, for monitoring if new more specifics (of the monitored prefixes) start to be announced
2019-07-15 10:36:01 +00:00
##### reports
Possible reports are:
2019-08-14 12:58:28 +02:00
* _reportEmail_, to send alerts by email. Smtp configurations are in config.yml
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* _reportFile_, to log the alerts in files. File directory, format, and log rotation configurations are in config.yml
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* _reportSlack_, to send alerts in Slack. Hook url is configurable in config.yml
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
## More information for developers
2019-07-15 10:36:01 +00:00
To start develop:
1. git clone this repo
2019-08-14 12:58:28 +02:00
2. install Node.js (version >= 10.16) and npm ([installing node and npm ](https://nodejs.org/en/download/ ))
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
3. execute `npm install` or `yarn` to install all dependencies ([installing yarn ](https://yarnpkg.com/lang/en/docs/install ))
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
4. run `npm run watch-and-serve` to run the application. At every file change it will self-reload.
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
### All npm commands
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* `npm run watch-and-serve` to run the application from source code and monitor for file changes
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* `npm run serve` to run the application from the source
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* `npm run test` to run the tests
* `npm run build` to compile and build OS native applications
2019-07-15 10:36:01 +00:00
### Composition
You can compose the tool with 3 main components: connectors, monitors, and reports.
All connectors must extend the class Connector. Monitors extend the class Monitor. Reports extend the class Report.
2019-07-15 10:42:12 +00:00
From the super class they will inherit various generic methods while some specific for the particular component have to be implemented.
2019-08-14 12:58:28 +02:00
Reports don't receive only alerts but also the data that provoked such alerts (so you can store the data and replay the accident later).
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
In `config.yml` , for each collection of components:
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* `file` - refers to the file name which contains the class
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* `channels` - refer to what channel(s) will be used to send or receive messages
2019-07-15 10:36:01 +00:00
2019-08-14 12:58:28 +02:00
* `params` - whatever parameters it may be needed to the component at creation time
2019-07-15 10:36:01 +00:00