File tree 10 files changed +101
-27
lines changed
charts/bitcoincore/charts/lnd/templates
plugins/simln/charts/simln/templates
10 files changed +101
-27
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,16 @@ outbounds 0.0
116
116
mempool_size 0.0
117
117
```
118
118
119
+ ### Defining lnd metrics to capture
120
+
121
+ Lightning nodes can also be configured to export metrics to prometheus using `lnd-exporter`.
122
+ Example configuration is provided in `test/data/ln/`. Review `node-defauts.yaml` for a typical logging configuration. All default metrics reported to prometheus are prefixed with `lnd_`
123
+
124
+ [lnd-exporter configuration reference](https://github.com/macgyver13/lnd-exporter/tree/main?tab=readme-ov-file#configuration)
125
+ lnd-exporter assumes same macaroon referenced in ln_framework (can be overridden by env variable)
126
+
127
+ **Note: `test/data/ln` and `test/data/logging` take advantage of **extraContainers** configuration option to add containers to default `lnd/templates/pod`*
128
+
119
129
### Grafana
120
130
121
131
Data from Prometheus exporters is collected and fed into Grafana for a
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ metadata:
4
4
name : {{ include "lnd.fullname" . }}
5
5
labels :
6
6
{{- include "lnd.labels" . | nindent 4 }}
7
+ role : macaroon-ref
7
8
data :
8
9
lnd.conf : |
9
10
{{- .Values.baseConfig | nindent 4 }}
37
38
AwEHoUQDQgAEBVltIvaTlAQI/3FFatTqVflZuZdRJ0SmRMSJrFLPtp0fxE7hmteS
38
39
t6gjQriy90fP8j9OJXBNAjt915kLY4zVvg==
39
40
-----END EC PRIVATE KEY-----
40
-
41
+ MACAROON_HEX : 0201036c6e6402f801030a1062beabbf2a614b112128afa0c0b4fdd61201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620b17be53e367290871681055d0de15587f6d1cd47d1248fe2662ae27f62cfbdc6
41
42
---
42
43
apiVersion : v1
43
44
kind : ConfigMap
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ metadata:
12
12
collect_logs : " true"
13
13
{{- end }}
14
14
chain : {{ .Values.global.chain }}
15
+ annotations :
16
+ kubectl.kubernetes.io/default-container : " lnd"
15
17
spec :
16
18
{{- with .Values.imagePullSecrets }}
17
19
imagePullSecrets :
56
58
- mountPath : /root/.lnd/tls.cert
57
59
name : config
58
60
subPath : tls.cert
59
- {{- if .Values.circuitBreaker }}
60
- - name : circuitbreaker
61
- image : pinheadmz/circuitbreaker:278737d
62
- imagePullPolicy : IfNotPresent
63
- {{- end}}
61
+ {{- with .Values.extraContainers }}
62
+ {{- toYaml . | nindent 4 }}
63
+ {{- end }}
64
64
volumes :
65
65
{{- with .Values.volumes }}
66
66
{{- toYaml . | nindent 4 }}
Original file line number Diff line number Diff line change 20
20
targetPort : rest
21
21
protocol : TCP
22
22
name : rest
23
+ {{- if .Values.metricsExport }}
24
+ - port : {{ .Values.prometheusMetricsPort }}
25
+ targetPort : prom-metrics
26
+ protocol : TCP
27
+ name : prometheus-metrics
28
+ {{- end }}
23
29
selector :
24
30
{{- include "lnd.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
1
+ {{- if .Values.metricsExport }}
2
+ apiVersion : monitoring.coreos.com/v1
3
+ kind : ServiceMonitor
4
+ metadata :
5
+ name : {{ include "lnd.fullname" . }}
6
+ labels :
7
+ app.kubernetes.io/name : lnd-metrics
8
+ release : prometheus
9
+ spec :
10
+ endpoints :
11
+ - port : prometheus-metrics
12
+ selector :
13
+ matchLabels :
14
+ app : {{ include "lnd.fullname" . }}
15
+ {{- end }}
Original file line number Diff line number Diff line change 17
17
IQDPofN0fEl5gTwCYhk3nZbjMqJhZ8BsSJ6K8XRhxr7zbwIhAPsgQCFOqUWg632O
18
18
NEO53OQ6CIqnpxSskjsFNH4ZBQOE
19
19
-----END CERTIFICATE-----
20
- admin.macaroon.hex : |
21
- 0201036c6e6402f801030a1062beabbf2a614b112128afa0c0b4fdd61201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620b17be53e367290871681055d0de15587f6d1cd47d1248fe2662ae27f62cfbdc6
20
+ {{- $configMaps := lookup "v1" "ConfigMap" .Release.Namespace "" }}
21
+ {{- range $configMaps.items }}
22
+ {{- if and .metadata.labels (hasKey .metadata.labels "role") (eq (index .metadata.labels "role") "macaroon-ref") }}
23
+ admin.macaroon.hex : {{ index .data "MACAROON_HEX" | quote }}
24
+ {{- end }}
25
+ {{- end }}
Original file line number Diff line number Diff line change 2
2
- name : tank-0000
3
3
addnode :
4
4
- tank-0001
5
- ln :
6
- lnd : true
7
-
8
5
- name : tank-0001
9
6
addnode :
10
7
- tank-0002
11
- ln :
12
- lnd : true
13
-
14
8
- name : tank-0002
15
9
addnode :
16
10
- tank-0000
17
- ln :
18
- lnd : true
19
-
20
11
- name : tank-0003
21
12
addnode :
22
13
- tank-0000
23
- ln :
24
- lnd : true
25
14
lnd :
26
15
config : |
27
16
bitcoin.timelockdelta=33
@@ -32,12 +21,9 @@ nodes:
32
21
target : tank-0004-ln
33
22
capacity : 100000
34
23
push_amt : 50000
35
-
36
24
- name : tank-0004
37
25
addnode :
38
26
- tank-0000
39
- ln :
40
- lnd : true
41
27
lnd :
42
28
channels :
43
29
- id :
46
32
target : tank-0005-ln
47
33
capacity : 50000
48
34
push_amt : 25000
49
-
50
35
- name : tank-0005
51
36
addnode :
52
- - tank-0000
53
- ln :
54
- lnd : true
37
+ - tank-0000
Original file line number Diff line number Diff line change
1
+ # enable collectLogs and metricsExport to activate publish lnd-exporter metrics
2
+
3
+ # Core configs
1
4
image :
2
5
repository : bitcoindevproject/bitcoin
3
6
pullPolicy : IfNotPresent
4
7
tag : " 27.0"
8
+ collectLogs : false
9
+ metricsExport : false
5
10
11
+ # LN configs
12
+ ln :
13
+ lnd : true
6
14
lnd :
7
15
defaultConfig : |
8
- color=#000000
16
+ color=#000000
17
+ config : |
18
+ bitcoin.timelockdelta=33
19
+ metricsExport : false
20
+ prometheusMetricsPort : 9332
21
+ extraContainers :
22
+ - name : lnd-exporter
23
+ image : bitdonkey/lnd-exporter:0.1.3
24
+ imagePullPolicy : IfNotPresent
25
+ volumeMounts :
26
+ - name : config
27
+ mountPath : /macaroon.hex
28
+ subPath : MACAROON_HEX
29
+ env :
30
+ - name : METRICS
31
+ value : >
32
+ lnd_balance_channels=parse("/v1/balance/channels","balance")
33
+ lnd_local_balance_channels=parse("/v1/balance/channels","local_balance.sat")
34
+ lnd_remote_balance_channels=parse("/v1/balance/channels","remote_balance.sat")
35
+ lnd_block_height=parse("/v1/getinfo","block_height")
36
+ lnd_peers=parse("/v1/getinfo","num_peers")
37
+ ports :
38
+ - name : prom-metrics
39
+ containerPort : 9332
40
+ protocol : TCP
Original file line number Diff line number Diff line change @@ -11,5 +11,27 @@ nodes:
11
11
- name : tank-0002
12
12
addnode :
13
13
- tank-0000
14
+ ln :
15
+ lnd : true
16
+ lnd :
17
+ metricsExport : true
18
+ prometheusMetricsPort : 9332
19
+ extraContainers :
20
+ - name : lnd-exporter
21
+ image : bitdonkey/lnd-exporter:0.1.3
22
+ imagePullPolicy : IfNotPresent
23
+ volumeMounts :
24
+ - name : config
25
+ mountPath : /macaroon.hex
26
+ subPath : MACAROON_HEX
27
+ env :
28
+ - name : METRICS
29
+ value : >
30
+ lnd_block_height=parse("/v1/getinfo","block_height")
31
+ lnd_peers=parse("/v1/getinfo","num_peers")
32
+ ports :
33
+ - name : prom-metrics
34
+ containerPort : 9332
35
+ protocol : TCP
14
36
caddy :
15
37
enabled : true
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ def get_five_values_for_metric(metric):
94
94
95
95
self .wait_for_predicate (lambda : get_five_values_for_metric ("blocks" ))
96
96
self .wait_for_predicate (lambda : get_five_values_for_metric ("txrate" ))
97
+ self .wait_for_predicate (lambda : get_five_values_for_metric ("lnd_block_height" ))
97
98
98
99
# Verify default dashboard exists
99
100
dbs = requests .get (f"{ self .grafana_url } /api/search" ).json ()
You can’t perform that action at this time.
0 commit comments