2020-05-04 17:32:25 +02:00
# Monitoring Eclair
Eclair uses [Kamon ](https://kamon.io/ ) to generate metrics and spans. Kamon automatically collects
many akka-related metrics and performance counters from the underlying system.
Kamon uses an agent ([Kanela ](https://github.com/kamon-io/kanela )) that runs alongside eclair and
periodically sends metrics and spans to a monitoring backend.
## Enabling monitoring with Kamon APM
Monitoring is disabled by default. To enable monitoring with Kamon's hosted platform, create an
account on their website and add the following to your `eclair.conf` :
```config
eclair.enable-kamon=true
kamon {
apm {
# Put the API key obtained from your Kamon account.
api-key=XXXXXXX
}
trace {
# Configures a sampler that decides which traces should be reported to the trace backends. The possible values are:
# - always: report all traces (will impact application performance).
# - never: don't report any trace.
# - random: randomly decide using the probability defined in the random-sampler.probability setting.
# - adaptive: keeps dynamic samplers for each operation while trying to achieve a set throughput goal.
sampler = "random"
}
}
```
When starting eclair, you should enable the Kanela agent:
```sh
eclair.sh -with-kanela
```
2021-02-08 10:20:23 +00:00
Your eclair node will start exporting monitoring data to Kamon.
2020-05-04 17:32:25 +02:00
You can then start creating dashboards, graphs and alerts directly on Kamon's website.
2022-06-16 21:22:57 +05:30
## Enabling monitoring with Prometheus
2020-05-04 17:32:25 +02:00
Kamon supports many other monitoring [backends ](https://kamon.io/docs/latest/reporters/ ).
This can be useful for nodes that don't want to export any data to third-party servers.
2022-06-16 21:22:57 +05:30
Eclair currently supports exporting metrics to [Prometheus ](https://kamon.io/docs/latest/reporters/prometheus/ ).
To enable monitoring with Prometheus, add the following to your `eclair.conf` :
```config
eclair.enable-kamon=true
// The Kamon APM reporter is enabled by default, but it won't work with Prometheus, so we disable it.
kamon.modules {
apm-reporter {
enabled = false
}
}
kamon {
prometheus {
start-embedded-http-server = yes
embedded-server {
hostname = 0.0.0.0
port = < port to expose to prometheus >
}
}
}
```
2022-12-01 14:52:59 +01:00
You should then configure your Prometheus process to scrape metrics from the exposed http server.
2022-06-16 21:22:57 +05:30
* Download Prometheus [here ](https://prometheus.io/download/ ).
2022-12-01 14:52:59 +01:00
* Add the following configuration to the `prometheus.yml` file (see the [Prometheus documentation ](https://prometheus.io/docs/prometheus/latest/configuration/configuration/ ) for more details).
2022-06-16 21:22:57 +05:30
```prometheus.yml
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: 'eclair'
static_configs:
- targets: ['< url of the eclair http embedded server > ']
```
2020-05-04 17:32:25 +02:00
2022-12-01 14:52:59 +01:00
Eclair provides [Grafana ](https://grafana.com/ ) dashboards to help you monitor your lightning node, which you can find in the `monitoring` folder of this repository.
Follow the [Grafana documentation ](https://grafana.com/docs/grafana/latest/dashboards/export-import/#import-dashboard ) to import these dashboards and create new ones if necessary.
2022-07-01 21:02:46 +05:30
Note: do not forget to add `Prometheus` as a data source in grafana (see [grafana documentation ](https://prometheus.io/docs/visualization/grafana/#creating-a-prometheus-data-source ) for more details)
2020-05-04 17:32:25 +02:00
## Example metrics
Apart from akka and system metrics, eclair generates a lot of lightning metrics. The following
metrics are just a small sample of all the metrics we provide:
* Number of local channels, grouped by their current state (offline, normal, closing, etc)
* Relayed payments and fees collected
* Number of connected peers
* Bitcoin wallet balance
* Various metrics about the public graph (nodes, channels, updates, etc)