2020-01-18 19:07:03 +01:00
# Process monitoring
2019-11-27 15:36:28 +01:00
2019-12-13 14:31:12 +01:00
Since version 1.22.0 it is possible to monitor the status of the BGPalerter process.
2019-11-27 15:36:28 +01:00
2019-12-13 14:31:12 +01:00
There are various approaches for monitoring the status of BGPalerter, each implemented in a specific module.
You can declare the modules you want to load/enable in `config.yml` , as follows:
```yaml
2020-01-18 19:05:56 +01:00
processMonitors:
2019-12-13 14:31:12 +01:00
- file: uptimeApi
params:
useStatusCodes: true
host: null
port: 8011
- file: uptimeHealthcheck
params:
url: url_to_poll
intervalSeconds: 300
method: get
2020-01-18 19:48:33 +01:00
- file: sentryModule
params:
dsn: https://<key>@sentry .io/<project>
2019-12-13 14:31:12 +01:00
```
## uptimeApi
The uptimeApi module enables an API to retrieve the current status of BGPalerter.
By default the API is reachable at `http://localhost:8011/status` and provides a summary of the status of various components of BGPalerter. If any of the components is having a problem, the attribute `warning` is set to true.
2019-11-27 15:36:28 +01:00
The following is an example of the API output.
```
{
"warning": false,
"connectors": [
{
"name": "ConnectorRIS",
"connected": true
}
]
}
2019-12-06 14:42:38 +01:00
```
2019-12-13 14:31:12 +01:00
In `config.yml` the uptimeApi is declared as:
```yaml
2020-01-18 19:05:56 +01:00
processMonitors:
2019-12-13 14:31:12 +01:00
- file: uptimeApi
params:
useStatusCodes: true
host: null
port: 8011
```
When the uptimeApi block is commented/deleted from the config file, no extra dependencies are loaded and no open port is required.
2019-12-06 14:42:38 +01:00
The API, in addition to the JSON answer, can use HTTP status codes for an easier integration with Nagios and similar.
2019-12-13 14:31:12 +01:00
Parameters for this module are:
|Parameter| Description|
|---|---|
|useStatusCodes| A boolean that if set to true enables HTTP status codes in the response. Nothing changes in the JSON output provided by the API. |
|host| The IP address on which the API will be reachable. If `null` or missing, the API will be reachable on all the addresses of the machine.|
|port| The port on which the API will be reachable. |
## uptimeHealthcheck
The uptimeHealthcheck module is a component that will start polling a provided URL at a regular interval.
2020-12-13 05:48:25 +01:00
This can be used to send a heartbeat signal to a monitoring system (e.g., https://healthchecks.io/).
2019-12-13 14:31:12 +01:00
If there is any warning about any component activated in BGPalerter, the heartbeat will not be issued (independently from the fact that the process is still running).
In `config.yml` the uptimeHealthcheck is declared as:
```yaml
2020-01-18 19:05:56 +01:00
processMonitors:
2019-12-13 14:31:12 +01:00
- file: uptimeHealthcheck
params:
url: url_to_poll
intervalSeconds: 300
method: get
```
If the `method` parameter is set to `post` , the body of the request will contain a detailed status of BGPalerter.
The status is reported in the same JSON format described for the uptimeApi module.
Parameters for this module are:
|Parameter| Description|
|---|---|
|url| The URL to be polled periodically. |
|intervalSecond| The interval (in seconds) between HTTP requests. |
|method| The method used for the HTTP request. It can be `get` or `post` . |
2020-01-18 19:48:33 +01:00
## sentryModule
2019-12-13 14:31:12 +01:00
2020-01-18 19:48:33 +01:00
The sentryModule is a component that allows the monitoring of the BGPalerter process for runtime exceptions.
Useful especially for testing new experimental modules.
2019-12-13 14:31:12 +01:00
2020-01-18 19:48:33 +01:00
To enable this feature, create a new project on your Sentry server and grab the generated DSN.
2019-12-13 14:31:12 +01:00
2020-01-18 19:48:33 +01:00
In `config.yml` the sentryModule is declared as:
2019-12-13 14:31:12 +01:00
2020-01-18 19:48:33 +01:00
```yaml
processMonitors:
2019-12-06 14:42:38 +01:00
2020-01-18 19:48:33 +01:00
- file: sentryModule
params:
dsn: https://<key>@sentry .io/<project>
```
Parameters for this module are:
|Parameter| Description|
|---|---|
|dsn| The DSN where the logs will be sent. |