3.12. Reading a management attribute

This section describes how to access the Neo4j management beans that are included in the JmxUtils class.

The JmxUtils class includes methods to access Neo4j management beans. The common JMX service can be used as well, but from your code you probably rather want to use the approach outlined below.

The source code of the example is found here: JmxDocTest.java

This example shows how to get the start time of a database:

    private static Date getStartTimeFromManagementBean(
            GraphDatabaseService graphDbService )
        ObjectName objectName = JmxUtils.getObjectName( graphDbService, "Kernel" );
        Date date = JmxUtils.getAttribute( objectName, "KernelStartTime" );
        return date;

Depending on which Neo4j edition you are using different sets of management beans are available.