Chapter 5. Monitoring

Table of Contents

This chapter covers how to use Neo4j monitoring facilities to log and display various metrics.

The monitoring features are available in the Neo4j Enterprise Edition.

Neo4j can be configured to report metrics in two different ways:

5.1. Enabling metrics logging

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

5.1.1. Graphite

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 minutes.
metrics.graphite.interval=3m
# 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.

5.1.2. 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 'false'.
metrics.csv.enabled=true
# Directory path for output files.
# Default is a "metrics" directory under NEO4J_HOME.
#metrics.csv.path='/local/file/system/path'
# How often to store data. Default is 3 minutes.
metrics.csv.interval=3m

The csv exporter does not automatically rotate the output files. When enabling the csv exporter, it is recommended to configure a job to periodically archive the files.

5.2. Available metrics

Table 5.1. Database CheckPointing Metrics
Name Description

neo4j.check_point.events

The total number of check point events executed so far

neo4j.check_point.total_time

The total time spent in check pointing so far

neo4j.check_point.check_point_duration

The duration of the check point event

Table 5.2. Database Data Metrics
Name Description

neo4j.ids_in_use.relationship_type

The total number of different relationship types stored in the database

neo4j.ids_in_use.property

The total number of different property names used in the database

neo4j.ids_in_use.relationship

The total number of relationships stored in the database

neo4j.ids_in_use.node

The total number of nodes stored in the database

Table 5.3. Database PageCache Metrics
Name Description

neo4j.page_cache.eviction_exceptions

The total number of exceptions seen during the eviction process in the page cache

neo4j.page_cache.flushes

The total number of flushes executed by the page cache

neo4j.page_cache.unpins

The total number of page unpins executed by the page cache

neo4j.page_cache.pins

The total number of page pins executed by the page cache

neo4j.page_cache.evictions

The total number of page evictions executed by the page cache

neo4j.page_cache.page_faults

The total number of page faults happened in the page cache

Table 5.4. Database Transaction Metrics
Name Description

neo4j.transaction.started

The total number of started transactions

neo4j.transaction.peak_concurrent

The highest peak of concurrent transactions ever seen on this machine

neo4j.transaction.active

The number of currently active transactions

neo4j.transaction.active_read

The number of currently active read transactions

neo4j.transaction.active_write

The number of currently active write transactions

neo4j.transaction.committed

The total number of committed transactions

neo4j.transaction.committed_read

The total number of committed read transactions

neo4j.transaction.committed_write

The total number of committed write transactions

neo4j.transaction.rollbacks

The total number of rolled back transactions

neo4j.transaction.rollbacks_read

The total number of rolled back read transactions

neo4j.transaction.rollbacks_write

The total number of rolled back write transactions

neo4j.transaction.terminated

The total number of terminated transactions

neo4j.transaction.terminated_read

The total number of terminated read transactions

neo4j.transaction.terminated_write

The total number of terminated write transactions

neo4j.transaction.last_committed_tx_id

The ID of the last committed transaction

neo4j.transaction.last_closed_tx_id

The ID of the last closed transaction

Table 5.5. Cypher Metrics
Name Description

neo4j.cypher.replan_events

The total number of times Cypher has decided to re-plan a query

Table 5.6. Database LogRotation Metrics
Name Description

neo4j.log_rotation.events

The total number of transaction log rotations executed so far

neo4j.log_rotation.total_time

The total time spent in rotating transaction logs so far

neo4j.log_rotation.log_rotation_duration

The duration of the log rotation event

Table 5.7. Network Metrics
Name Description

neo4j.network.slave_network_tx_writes

The amount of bytes transmitted on the network containing the transaction data from a slave to the master in order to be committed

neo4j.network.master_network_store_writes

The amount of bytes transmitted on the network while copying stores from a machines to another

neo4j.network.master_network_tx_writes

The amount of bytes transmitted on the network containing the transaction data from a master to the slaves in order to propagate committed transactions

Table 5.8. Cluster Metrics
Name Description

neo4j.cluster.slave_pull_updates

The total number of update pulls executed by this instance

neo4j.cluster.slave_pull_update_up_to_tx

The highest transaction id that has been pulled in the last pull updates by this instance

neo4j.cluster.is_master

Whether or not this instance is the master in the cluster

neo4j.cluster.is_available

Whether or not this instance is available in the cluster

5.2.1. Java Virtual Machine Metrics

These metrics are environment dependent and they may vary on different hardware and with JVM configurations. Typically these metrics will show information about garbage collections (for example the number of events and time spent collecting), memory pools and buffers, and finally the number of active threads running.