@@ -7,14 +7,16 @@ import { Callout } from 'nextra/components'
77
88# Monitoring
99
10- Monitoring applications and databases is essential to track the load, resources, logs, transactions, latency, etc .
10+ Monitoring applications and databases is essential to track the load and resources used by the system .
1111
1212Memgraph currently supports:
13- 1 . ** Log tracking via WebSocket server** : Log tracking is helpful for debugging purposes and monitoring the database operations.
14- 2 . ** Monitoring via HTTP server (Enterprise Edition)** : In the Enterprise edition, besides log tracking, Memgraph allows tracking information about transactions, query latencies, snapshot recovery latencies, triggers, bolt messages, indexes, and more, using an HTTP server.
13+ 1 . ** Real-time logs tracking via WebSocket server** : Log tracking is helpful for debugging purposes and monitoring the database operations.
14+ 2 . ** Metrics tracking via HTTP server (Enterprise Edition)** : In the Enterprise edition, besides log tracking, Memgraph allows tracking information about
15+ transactions, query latencies, snapshot recovery latencies, triggers, Bolt
16+ messages, indexes, streams, memory, operators and sesions, all by using an HTTP server.
1517
1618
17- ## Log tracking via WebSocket server
19+ ## Real-time logs tracking via WebSocket server
1820
1921Connect to Memgraph's logging server via WebSocket to forward logs to all the
2022connected clients.
@@ -78,24 +80,20 @@ asyncio.run(read_logs())
7880The code structure is similar in other languages, depending on the WebSocket
7981library used.
8082
81- If you want to connect with a WebSocket Secure (WSS) connection. Set the
82- following configuration flags to enable an SSL connection: ` --bolt-cert-file `
83- and ` --bolt-key-file ` .
84-
85- These flags are also used to set up an SSL connection when connecting via Bolt
86- protocol, hence the name. Refer to the configuration page to learn how to
87- [ update the
83+ If you want to connect with a WebSocket Secure (WSS) connection, set the
84+ ` --bolt-cert-file ` and ` --bolt-key-file ` configuration flags to enable an SSL
85+ connection. Refer to the configuration page to learn how to [ update the
8886configuration] ( /database-management/configuration#changing-configuration ) and to
8987see the list of all available [ configuration
9088flags] ( /database-management/configuration#list-of-configuration-flags ) .
9189
9290
9391### Authentication
9492
95- If authentication is not used (there are no users present in Memgraph) , no
93+ When authentication is not used due to no users present in Memgraph, no
9694authentication message is expected, and no response will be returned.
9795
98- If the authentication is used, Memgraph won't send a message to a certain
96+ When the authentication is used, Memgraph won't send a message to a certain
9997connection until it's authenticated.
10098
10199To authenticate, create a JSON with the credentials in the following format:
@@ -145,12 +143,12 @@ ws_url = f"ws://{HOST}:{PORT}"
145143
146144async def authenticate_and_read_logs (websocket ):
147145 # Send authentication credentials
148- credentials = json.dumps({" username" : USERNAME , " password" : PASSWORD })
146+ credentials = json.dumps({" username" : USERNAME , " password" : PASSWORD })
149147 await websocket.send(credentials)
150148
151149 # Wait for authentication response
152- response = await websocket.recv()
153- response_data = json.loads(response)
150+ response = await websocket.recv()
151+ response_data = json.loads(response)
154152 if response_data.get(" success" ):
155153 print (" Authentication successful!" )
156154 else :
@@ -160,7 +158,7 @@ async def authenticate_and_read_logs(websocket):
160158 # After successful authentication, start reading logs
161159 try :
162160 while True :
163- log_message = await websocket.recv()
161+ log_message = await websocket.recv()
164162 print (log_message)
165163 except websockets.exceptions.ConnectionClosed:
166164 print (" Connection to Memgraph closed." )
@@ -183,11 +181,11 @@ Permission for connecting through WebSocket is controlled by the [`WEBSOCKET`
183181privilege] ( /database-management/authentication-and-authorization/role-based-access-control#privileges ) .
184182
185183
186- ## Monitoring via HTTP server (Enterprise)
184+ ## Metrics tracking via HTTP server (Enterprise Edition )
187185
188186In the Enterprise Edition, Memgraph allows tracking information about
189187transactions, query latencies, snapshot recovery latencies, triggers, Bolt
190- messages, indexes, streams, and many more metrics using an HTTP server.
188+ messages, indexes, streams, memory, operators and sesions, all by using using an HTTP server.
191189
192190To retrieve data from the HTTP server, [ enter a valid Memgraph
193191Enterprise license key] ( /database-management/enabling-memgraph-enterprise ) .
@@ -210,15 +208,15 @@ import json
210208
211209
212210def fetch_memgraph_metrics ():
213- metrics_url = " http://0.0.0.0:9091/metrics"
211+ metrics_url = " http://0.0.0.0:9091/metrics"
214212
215213 try :
216- response = requests.get(metrics_url, timeout = 5 )
214+ response = requests.get(metrics_url, timeout = 5 )
217215
218216 if response.status_code == 200 :
219217 try :
220- metrics_data = json.loads(response.text)
221- pretty_metrics = json.dumps(metrics_data, indent = 4 )
218+ metrics_data = json.loads(response.text)
219+ pretty_metrics = json.dumps(metrics_data, indent = 4 )
222220 print (" Memgraph Metrics:\n " , pretty_metrics)
223221 except json.JSONDecodeError:
224222 print (" Memgraph Metrics:\n " , response.text)
@@ -399,22 +397,20 @@ to the one below.
399397{
400398 "General" : {
401399 "average_degree" : 0.0 ,
402- "disk_usage" : 238141 ,
400+ "disk_usage" : 1417846 ,
403401 "edge_count" : 0 ,
404- "memory_usage" : 46329856 ,
405- "peak_memory_usage" : 46329856 ,
406- "unreleased_delta_objects" : 0 ,
402+ "memory_usage" : 36937728 ,
403+ "peak_memory_usage" : 100265984 ,
407404 "vertex_count" : 0
408405 },
409406 "Index" : {
410407 "ActiveLabelIndices" : 0 ,
411- "ActiveLabelPropertyIndices" : 0 ,
408+ "ActiveLabelPropertyIndices" : 0 ,
412409 "ActiveTextIndices" : 0
413- },
410+ },
414411 "Memory" : {
415- "PeakMemoryRes" : 46329856 ,
416- "UnreleasedDeltaObjects" : 0
417- },
412+ "PeakMemoryRes" : 100265984
413+ },
418414 "Operator" : {
419415 "AccumulateOperator" : 0 ,
420416 "AggregateOperator" : 0 ,
@@ -470,42 +466,42 @@ to the one below.
470466 "WriteQuery" : 0
471467 },
472468 "Session" : {
473- "ActiveBoltSessions" : 1 ,
469+ "ActiveBoltSessions" : 0 ,
474470 "ActiveSSLSessions" : 0 ,
475- "ActiveSessions" : 1 ,
476- "ActiveTCPSessions" : 1 ,
471+ "ActiveSessions" : 0 ,
472+ "ActiveTCPSessions" : 0 ,
477473 "ActiveWebSocketSessions" : 0 ,
478- "BoltMessages" : 3
479- },
474+ "BoltMessages" : 0
475+ },
480476 "Snapshot" : {
481- "SnapshotCreationLatency_us_50p" : 0 ,
482- "SnapshotCreationLatency_us_90p" : 0 ,
483- "SnapshotCreationLatency_us_99p" : 0 ,
484- "SnapshotRecoveryLatency_us_50p" : 0 ,
485- "SnapshotRecoveryLatency_us_90p" : 0 ,
486- "SnapshotRecoveryLatency_us_99p" : 0
487- },
477+ "SnapshotCreationLatency_us_50p" : 4860 ,
478+ "SnapshotCreationLatency_us_90p" : 4860 ,
479+ "SnapshotCreationLatency_us_99p" : 4860 ,
480+ "SnapshotRecoveryLatency_us_50p" : 628 ,
481+ "SnapshotRecoveryLatency_us_90p" : 628 ,
482+ "SnapshotRecoveryLatency_us_99p" : 628
483+ },
488484 "Stream" : {
489485 "MessagesConsumed" : 0 ,
490486 "StreamsCreated" : 0
491487 },
492488 "Transaction" : {
493489 "ActiveTransactions" : 0 ,
494- "CommitedTransactions" : 1 ,
495- "FailedPrepare" : 1 ,
490+ "CommitedTransactions" : 0 ,
491+ "FailedPrepare" : 0 ,
496492 "FailedPull" : 0 ,
497- "FailedQuery" : 1 ,
493+ "FailedQuery" : 0 ,
498494 "RollbackedTransactions" : 0 ,
499- "SuccessfulQuery" : 1
500- },
495+ "SuccessfulQuery" : 0
496+ },
501497 "Trigger" : {
502498 "TriggersCreated" : 0 ,
503499 "TriggersExecuted" : 0
504500 }
505501}
506502```
507503
508- ## Prometeus exporter
504+ ## Prometheus exporter
509505
510506Memgraph also supports exporting metrics in the
511507[ Prometheus] ( https://prometheus.io/ ) format. For more information on how to set
0 commit comments