Neo4j
Monitor Neo4j graph database metrics with OpenTelemetry and Last9
Use OpenTelemetry to monitor your Neo4j graph database and send telemetry data to Last9. Neo4j Enterprise exposes metrics natively via a built-in Prometheus endpoint on port 2004 — no exporter sidecar required.
Read the sample configuration for more details.
Prerequisites
- Neo4j Enterprise Edition 5.x installed and running
- Administrative access to
neo4j.conf - Last9 account with integration credentials
Enable Neo4j Prometheus Metrics
The Prometheus metrics endpoint is disabled by default. Enable it in neo4j.conf:
server.metrics.prometheus.enabled=trueserver.metrics.prometheus.endpoint=0.0.0.0:2004Restart Neo4j to apply the change:
sudo systemctl restart neo4jVerify the endpoint is reachable:
curl http://localhost:2004/metrics | head -20Install OpenTelemetry Collector
sudo apt-get update && sudo apt-get install -y wgetwget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_amd64.debsudo dpkg -i otelcol-contrib_0.144.0_linux_amd64.debsudo apt-get update && sudo apt-get install -y wgetwget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_arm64.debsudo dpkg -i otelcol-contrib_0.144.0_linux_arm64.debwget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_amd64.rpmsudo rpm -ivh otelcol-contrib_0.144.0_linux_amd64.rpmConfigure OpenTelemetry Collector
-
Create the Collector Configuration
Create
/etc/otelcol-contrib/config.yaml:receivers:prometheus:config:scrape_configs:- job_name: neo4jscrape_interval: 60smetrics_path: /metricsstatic_configs:- targets: ["localhost:2004"]hostmetrics:collection_interval: 60sscrapers:cpu:metrics:system.cpu.logical.count:enabled: truememory:metrics:system.memory.utilization:enabled: truesystem.memory.limit:enabled: trueload:disk:filesystem:metrics:system.filesystem.utilization:enabled: truenetwork:paging:processors:batch:timeout: 5ssend_batch_size: 10000send_batch_max_size: 10000resourcedetection/system:detectors: ["system"]system:hostname_sources: ["os"]transform/hostmetrics:metric_statements:- context: datapointstatements:- set(attributes["host.name"], resource.attributes["host.name"])- set(attributes["db.system"], "neo4j")exporters:otlp/last9:endpoint: "{{ .Logs.WriteURL }}"headers:"Authorization": "{{ .Logs.AuthValue }}"debug:verbosity: detailedservice:pipelines:metrics:receivers: [prometheus, hostmetrics]processors: [batch, resourcedetection/system, transform/hostmetrics]exporters: [otlp/last9, debug]Replace the
endpointandAuthorizationvalues with your actual Last9 credentials from the Integrations page. -
Start the Collector
sudo systemctl daemon-reloadsudo systemctl enable otelcol-contribsudo systemctl start otelcol-contrib
Metrics Collected
| Metric category | Examples |
|---|---|
| Transactions | neo4j_database_neo4j_transaction_committed_total, neo4j_database_neo4j_transaction_rollbacks_total |
| Bolt connections | neo4j_dbms_bolt_connections_opened_total, neo4j_dbms_bolt_connections_idle |
| Page cache | neo4j_dbms_page_cache_hits_total, neo4j_dbms_page_cache_page_faults_total, neo4j_dbms_page_cache_hit_ratio |
| Store sizes | neo4j_database_neo4j_store_size_total, neo4j_database_neo4j_store_size_database |
| Query execution | neo4j_database_neo4j_db_query_execution_latency_millis, neo4j_database_neo4j_db_query_execution_success_total |
| GC / JVM | neo4j_dbms_vm_gc_time_g1_young_generation_total, neo4j_dbms_vm_heap_used, neo4j_dbms_vm_threads |
| System | CPU, memory, disk, network via hostmetrics |
Verification
-
Check Collector Status
sudo systemctl status otelcol-contrib -
View Collector Logs
sudo journalctl -u otelcol-contrib -f -
Verify Metrics in Last9
Log into your Last9 account and check that Neo4j metrics are being received. Look for metric names starting with
neo4j_.
Troubleshooting
-
Prometheus endpoint not responding
# Check Neo4j is runningsudo systemctl status neo4j# Verify the metrics port is listeningss -tlnp | grep 2004# Check neo4j.conf changes took effectgrep prometheus /etc/neo4j/neo4j.conf -
Collector not scraping
# Check for errors in collector logssudo journalctl -u otelcol-contrib -n 50 --no-pager# Test the endpoint directly from the collector hostcurl http://localhost:2004/metrics | wc -l
Please get in touch with us on Discord or Email if you have any questions.