I want to fetch various metrics like read/write latency, disk utilisation etc. of each of my Cassandra nodes(without using JMX) as a JSON object. It seems to me that MetricsServlet, can do exactly that. However, I'm still not able to figure out, what all do I need to do in order to use it(metrics-servlets does not come with Cassandra). I'll appreciate if I can get some advice/sample code(for fetching any metric).
Asked
Active
Viewed 138 times
1 Answers
1
Cassandra is not a java web server, it doesnt support servlets. You would need to start a java web server in same JVM as Cassandra and load those servlets. While possible its probably a lot less work to just query the metrics via JMX and convert to JSON with an external application or to expose JMX via http with something like MX4J (what I would recommend)

Chris Lohfink
- 16,150
- 1
- 29
- 38
-
Are you aware of any method of fetching the metrics and then converting them into JSON which won't use JMX because it seems that using JMX for gathering metrics is not recommended in production. Check the warning here: http://metrics.dropwizard.io/3.1.0/manual/core/ – Vishal Sharma Apr 03 '18 at 05:27
-
Also, I've not worked in Http/Java before(Pardon me but I'll try to learn them ASAP), therefore, when you say exposing JMX via http, what exactly does that mean? Also, is MX4J a GUI tool like Ganglia? I'll appreciate if you can guide in brief what I'll get by using MX4J. – Vishal Sharma Apr 03 '18 at 05:33