DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Auto-Scaling Kinesis Data Streams Applications on Kubernetes
  • A Data-Driven Approach to Application Modernization
  • Introduction To Git
  • 5 Key Concepts for MQTT Broker in Sparkplug Specification

Trending

  • Auto-Scaling Kinesis Data Streams Applications on Kubernetes
  • A Data-Driven Approach to Application Modernization
  • Introduction To Git
  • 5 Key Concepts for MQTT Broker in Sparkplug Specification
  1. DZone
  2. Data Engineering
  3. Databases
  4. Neo4j: Accessing JMX beans via HTTP

Neo4j: Accessing JMX beans via HTTP

Mark Needham user avatar by
Mark Needham
·
Dec. 24, 13 · Interview
Like (0)
Save
Tweet
Share
7.20K Views

Join the DZone community and get the full member experience.

Join For Free

One of the additional features that Neo4j enterprise provides is access to various JMX properties which describe various aspects of the database.

These would typically be accessed by using jConsole or similar but some monitoring tools aren’t able to use the JMX hook and a HTTP interface would work better.

Luckily Neo4j server does expose the JMX beans and we can get a list of URIs to query by hitting the following URI:

$ curl -H "Content-Type:application/json" http://localhost:7474/db/manage/server/jmx/
{
"resources" : {
"kernelquery" : "http://localhost:7474/db/manage/server/jmx/kernelquery",
"bean" : "http://localhost:7474/db/manage/server/jmx/domain/{domain}/{objectName}",
"query" : "http://localhost:7474/db/manage/server/jmx/query",
"domains" : "http://localhost:7474/db/manage/server/jmx/domain",
"domain" : "http://localhost:7474/db/manage/server/jmx/domain/{domain}"
}
}

If we want to get the output for all JMX beans we can hit the following URI:

$ curl -H "Content-Type:application/json" http://localhost:7474/db/manage/server/jmx/domain/*/*
// cut for verbosity
...
{
"description" : "Estimates of the numbers of different kinds of Neo4j primitives",
"name" : "org.neo4j:instance=kernel#0,name=Primitive count",
"attributes" : [ {
"description" : "An estimation of the number of nodes used in this Neo4j instance",
"name" : "NumberOfNodeIdsInUse",
"value" : 24117,
"isReadable" : "true",
"type" : "long",
"isWriteable" : "false ",
"isIs" : "false "
}, {
"description" : "An estimation of the number of relationships used in this Neo4j instance",
"name" : "NumberOfRelationshipIdsInUse",
"value" : 1,
"isReadable" : "true",
"type" : "long",
"isWriteable" : "false ",
"isIs" : "false "
}, {
"description" : "An estimation of the number of properties used in this Neo4j instance",
"name" : "NumberOfPropertyIdsInUse",
"value" : 19078,
"isReadable" : "true",
"type" : "long",
"isWriteable" : "false ",
"isIs" : "false "
}, {
"description" : "The number of relationship types used in this Neo4j instance",
"name" : "NumberOfRelationshipTypeIdsInUse",
"value" : 0,
"isReadable" : "true",
"type" : "long",
"isWriteable" : "false ",
"isIs" : "false "
} ],
"url" : "org.neo4j/instance%3Dkernel%230%2Cname%3DPrimitive+count"
}
...

If we only wanted to return the the numbers of different kinds of Neo4j primitives we could run the following query which uses the name returned by the previous query:

$ curl -H "Content-Type:application/json" -d '["org.neo4j:name=Primitive count,instance=*"]' http://localhost:7474/db/manage/server/jmx/query
[ {
"description" : "Estimates of the numbers of different kinds of Neo4j primitives",
"name" : "org.neo4j:instance=kernel#0,name=Primitive count",
"attributes" : [ {
"description" : "An estimation of the number of nodes used in this Neo4j instance",
"name" : "NumberOfNodeIdsInUse",
"value" : 24117,
"isReadable" : "true",
"type" : "long",
"isWriteable" : "false ",
"isIs" : "false "
}],
...
"url" : "org.neo4j/instance%3Dkernel%230%2Cname%3DPrimitive+count"
} ]

We could also use the following URI if we don’t want to/can’t send a POST body:

$ curl -H "Content-Type:application/json" http://localhost:7474/db/manage/server/jmx/domain/org.neo4j/instance%3Dkernel%230%2Cname%3DPrimitive+count
[ {
"description" : "Estimates of the numbers of different kinds of Neo4j primitives",
"name" : "org.neo4j:instance=kernel#0,name=Primitive count",
"attributes" : [ {
"description" : "An estimation of the number of nodes used in this Neo4j instance",
"name" : "NumberOfNodeIdsInUse",
"value" : 24117,
"isReadable" : "true",
"type" : "long",
"isWriteable" : "false ",
"isIs" : "false "
}],
...
"url" : "org.neo4j/instance%3Dkernel%230%2Cname%3DPrimitive+count"
} ]
Neo4j Bean (software) Spring Framework

Published at DZone with permission of Mark Needham, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Auto-Scaling Kinesis Data Streams Applications on Kubernetes
  • A Data-Driven Approach to Application Modernization
  • Introduction To Git
  • 5 Key Concepts for MQTT Broker in Sparkplug Specification

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: