This section describes how to log and display various metrics by using the Neo4j metrics output facilities.
This section describes the following:
By default, metrics logging is enabled and configured to report metrics into CSV files.
Neo4j can expose metrics for the following parts of the database:
# Setting for enabling all supported metrics. metrics.enabled=true # Setting for enabling all Neo4j-specific metrics. metrics.neo4j.enabled=true # Setting for exposing metrics about transactions; number of transactions started, committed, etc. metrics.neo4j.tx.enabled=true # Setting for exposing metrics about the Neo4j page cache; page faults, evictions, flushes and exceptions, etc. metrics.neo4j.pagecache.enabled=true # Setting for exposing metrics about approximately entities are in the database; nodes, relationships, properties, etc. metrics.neo4j.counts.enabled=true # Setting for exposing metrics about the network usage of the HA cluster component. metrics.neo4j.network.enabled=true
Send metrics to Graphite or any monitoring tool based on the Graphite protocol.
Add the following settings to neo4j.conf in order to enable integration with Graphite:
# Enable the Graphite integration. Default is 'false'. metrics.graphite.enabled=true # The IP and port of the Graphite server on the format <hostname or IP address>:<port number>. # The default port number for Graphite is 2003. metrics.graphite.server=localhost:2003 # How often to send data. Default is 3 seconds. metrics.graphite.interval=3s # Prefix for Neo4j metrics on Graphite server. metrics.prefix=Neo4j_1
Start Neo4j and connect to Graphite via a web browser in order to monitor your Neo4j metrics.
If you configure the Graphite server to be a hostname or DNS entry you should be aware that the JVM resolves hostnames to
IP addresses and by default caches the result indefinitely for security reasons.
This is controlled by the value of
Publish metrics for polling as Prometheus endpoint.
Add the following settings to neo4j.conf in order to enable the Prometheus endpoint.
# Enable the Prometheus endpoint. Default is 'false'. metrics.prometheus.enabled=true # The IP and port the endpoint will bind to in the format <hostname or IP address>:<port number>. # The default is localhost:2004. metrics.prometheus.endpoint=localhost:2004
When Neo4j is fully started a Prometheus endpoint will be available at the configured address.
Export metrics to CSV files.
Add the following settings to neo4j.conf in order to enable export of metrics into local .CSV files:
# Enable the CSV exporter. Default is 'true'. metrics.csv.enabled=true # Directory path for output files. # Default is a "metrics" directory under NEO4J_HOME. #dbms.directories.metrics='/local/file/system/path' # How often to store data. Default is 3 seconds. metrics.csv.interval=3s # The maximum number of CSV files that will be saved. Default is 7. metrics.csv.rotation.keep_number # The file size at which the csv files will auto-rotate. Default is 10M. metrics.csv.rotation.size=10M