11# lndmon
22
3- #### A drop-in monitoring solution for your lnd node using Prometheus and Grafana.
3+ #### A drop-in monitoring solution for your lnd node that integrates with Prometheus and Grafana.
44
55<img src =" dashboard.png " >
66
77## What is this?
88
9- ` lndmon ` is a drop-in, dockerized monitoring/metric collection solution for your
10- individual lnd nodes connected to bitcoin. With this system, you'll be able to
11- closely monitor the health and status of your ` lnd ` node.
9+ ` lndmon ` is a drop-in, monitoring/metric collection solution for your
10+ individual lnd nodes connected to bitcoin which allows you to closely monitor
11+ the health and status of your ` lnd ` node.
1212
13- There are three primary components of the ` lndmon ` system:
13+ There are four primary components of this monitoring system:
1414
15151 . [ lnd] ( https://github.com/lightningnetwork/lnd ) built with the ` monitoring `
16- tag, which enables lnd to export metrics about its gRPC performance and
17- usage. These metrics provide insights such as how many bytes lnd is
18- transmitting over gRPC, whether any calls are taking a long time to complete,
19- and other related statistics.
20-
21- 2 . ` lndmon ` : while lnd provides some information, ` lndmon ` by far does the heavy
22- lifting with regards to metrics. With ` lndmon ` 's data, you can track routing
23- fees over time, track how the channel graph evolves, and have a highly
24- configurable "crystal ball" to forecast and de-escalate potential issues as
25- the network changes over time. There is also a strong set of metrics for
26- users who want to keep track of their own node and channels, or just explore
27- and create their own lightning data visualizations.
28-
29- 3 . Last but not least, ` lndmon ` uses [ Grafana] ( https://grafana.com/ ) as its
16+ tag, which enables lnd to export metrics about its gRPC performance and
17+ usage.
18+ - These metrics provide insights such as how many bytes lnd is transmitting
19+ over gRPC, whether any calls are taking a long time to complete, and other
20+ related statistics.
21+ - ` lnd ` build notes:
22+ * If you are using a release build of ` lnd ` or ` litd ` , this was enabled
23+ during build and no action is required.
24+ * If you are building from source, make sure to include the ` monitoring `
25+ tag (i.e. ` make && make install tags=monitoring ` )
26+ - Default ` lnd ` config options:
27+ * ` prometheus.enable=false `
28+ - Need to change to ` true ` to enable.
29+ * ` prometheus.listen=127.0.0.1:8989 `
30+ - You may want to change to ` 0.0.0.0:8989 ` to listen on all interfaces.
31+ * ` prometheus.perfhistograms=false `
32+ - Enabling this uses more RAM and disk space.
33+ - Note: This data can be obtained from ` lnd ` without ` lndmon ` being
34+ installed.
35+
36+ 2 . ` lndmon ` : while lnd provides some information about gRPC performance
37+ statistics directly via its own prometheus exporter, ` lndmon ` by far does
38+ the heavy lifting with regards to metrics.
39+ - With ` lndmon ` 's data, you can track routing fees over time, track how the
40+ channel graph evolves, and have a highly configurable "crystal ball" to
41+ forecast and de-escalate potential issues as the network changes over time.
42+ - There is also a strong set of metrics for users who want to keep track of
43+ their own node and channels, or just explore and create their own
44+ lightning data visualizations.
45+ - See [ Options] ( #options ) below for ` lndmon ` config options.
46+ - Note: This data can be obtained without lnd being built with the
47+ ` monitoring ` tag and without the ` prometheus.enable ` config option enabled,
48+ but it does require ` lnd ` to be listening for gRPC connections.
49+
50+ 3 . Prometheus is a time series database that scrapes data from ` lnd ` and
51+ ` lndmon ` and stores it for later analysis.
52+
53+ 4 . ` lndmon ` uses [ Grafana] ( https://grafana.com/ ) as its
3054 primary dashboard to display all its collected metrics. Grafana is highly
3155 configurable and can create beautiful and detailed graphs organized by
3256 category (i.e., chain-related graphs, fee-related graphs, etc). Users have
3357 the option of making their Grafana dashboards remotely accessible over TLS
3458 with passwords to ensure their data is kept private.
3559
60+
61+ # Architectural Layout
62+ ``` mermaid
63+ ---
64+ config:
65+ flowchart:
66+ subGraphTitleMargin:
67+ bottom: 30
68+ ---
69+ flowchart
70+ subgraph s1["**LND**"]
71+ n15@{ shape: "stadium", label: "gRPC Server \n(TCP/10009)" }
72+ n20@{ shape: "stadium", label: "Prometheus Exporter \n (TCP/8989) " }
73+ end
74+ s1
75+
76+ n15
77+ subgraph s2["**LNDmon**
78+ (aggregate, cache)"]
79+
80+ n17@{ shape: "stadium", label: "Prometheus Exporter \n (TCP/9092)" }
81+ n16@{ shape: "stadium", label: "gRPC Client \n (TCP/9090)" }
82+ end
83+ n16@{ shape: "stadium", label: "gRPC Client<br>(TCP/9090)" }
84+ n21@{ shape: "fr-rect", label: "gRPC Performance Stats" }
85+ n20@{ shape: "stadium", label: "Prometheus Exporter<br>(TCP/8989)" } --- n21
86+ subgraph s3["**Prometheus**<br/>(time series DB)"]
87+ n23@{ shape: "stadium", label: "HTTP Server" }
88+ n22@{ shape: "stadium", label: "Prometheus Scraper" }
89+ end
90+ n21 --- n22
91+ n7@{ shape: "fr-rect", label: "gRPC Call Data" }
92+ n17@{ shape: "stadium", label: "Prometheus Exporter<br>(TCP/9092)" } --- n7
93+ n7 --- n22
94+ subgraph s4["**Grafana**<br/>(dashboard generation)"]
95+ n25@{ shape: "stadium", label: "HTTP Server" }
96+ n24@{ shape: "stadium", label: "HTTP Client" }
97+ end
98+ subgraph s5["**Firefox**<br/>(dashboard display)"]
99+ n26@{ shape: "stadium", label: "HTTP Client" }
100+ end
101+ n23@{ shape: "stadium", label: "HTTP Server<br>(TCP/9090)" } --- n24
102+ n25@{ shape: "stadium", label: "HTTP Server<br>(TCP/3000)" } --- n26
103+ n15 --- n16@{ shape: "stadium", label: "gRPC Client" }
104+ s1
105+ n21
106+ n22 --- n23
107+ n24 --- n25
108+ n16 --- n17
109+ ```
110+
111+
112+
113+
114+
36115## Why would I want to use this?
37116
38117Monitoring can provide crucial insights into the health of large-scale
@@ -46,9 +125,63 @@ ecosystem (i.e., "wow, the day [Lightning
46125App] ( https://github.com/lightninglabs/lightning-app ) was released coincides with
47126the addition of 3000 channels to the network!").
48127
49- ## How do I install this?
50128
51- Head over to [ ` INSTALL.md ` ] ( https://github.com/lightninglabs/lndmon/blob/master/INSTALL.md ) . It
52- also includes instructions to set up, access, and password-protect the dashboard
53- that comes with Prometheus, called the Prometheus expression browser, for those
54- interested in using it.
129+ ## Build
130+
131+ ```
132+ git clone https://github.com/lightninglabs/lndmon
133+ cd lndmon/cmd/lndmon
134+ go build
135+ ```
136+
137+ ## Options
138+
139+ ```
140+ $ lndmon -h
141+ Usage:
142+ lndmon [OPTIONS]
143+
144+ Application Options:
145+ --primarynode= Public key of the primary node in a primary-gateway setup
146+ --disablegraph Do not collect graph metrics
147+ --disablehtlc Do not collect HTLCs metrics
148+ --disablepayments Do not collect payments metrics
149+
150+ prometheus:
151+ --prometheus.listenaddr= the interface we should listen on for prometheus (default:
152+ localhost:9092)
153+ --prometheus.logdir= Directory to log output (default: /home/user/.lndmon/logs)
154+ --prometheus.maxlogfiles= Maximum log files to keep (0 for no rotation) (default: 3)
155+ --prometheus.maxlogfilesize= Maximum log file size in MB (default: 10)
156+
157+ lnd:
158+ --lnd.host= lnd instance rpc address (default: localhost:10009)
159+ --lnd.network=[regtest|testnet|testnet4|mainnet|simnet|signet] network to run on (default: mainnet)
160+ --lnd.macaroondir= Path to lnd macaroons (default: /home/user/.lnd)
161+ --lnd.macaroonname= The name of our macaroon in macaroon dir to use. (default:
162+ readonly.macaroon)
163+ --lnd.rpctimeout= The timeout for rpc calls to lnd. Valid time units are {s,
164+ m, h}. (default: 30s)
165+ --lnd.tlspath= Path to lnd tls certificate
166+
167+ Help Options:
168+ -h, --help Show this help message
169+ ```
170+
171+
172+
173+
174+
175+
176+
177+
178+
179+
180+
181+ ## How do I use this?
182+
183+ Head over to [ ` Docker_Usage.md ` ] ( https://github.com/lightninglabs/lndmon/blob/master/Docker_Usage.md )
184+ for information on how to setup a dockerized version. It also includes
185+ instructions to set up, access, and password-protect the dashboard that comes
186+ with Prometheus, called the "Prometheus Expression Browser", for those interested
187+ in using it.
0 commit comments