I’m attempting to create a connection between Cassandra on EC2 and AWS CloudWatch for sending JMX/MBeans metrics. After setting up the configurations for both Telegraf and Cassandra, when I restart the services and check the sudo systemctl status telegraf, I receive:
[inputs.jolokia2_agent] Error in plugin: unable to gather metrics for "http://localhost:7199/jolokia": Post "http://localhost:7199/jolokia/read": dial tcp 127.0.0.1:7199: connect: connection refused
I have tried enabling remote JMX in cassandra-env.sh, setting the listen_address in cassandra.yaml to localhost, and trying a variety of URLs in the telegraf.conf file for setting up the jolokia2 plugin to capture JMX metrics from Cassandra. Nothing works and I’m not sure what to check any more.
This is probably a better question for the cassandra community. That error message means we cannot connect to your local system and port 7199. Are you sure that is the right port? That port doesn’t look the same as others I’ve seen in guides and docs.
I’ve seen 8778 used in other examples, our own cassandra example:
I think this issue I was experiencing was due to not having the Jolokia Agent installed on my instance. I didn’t realize that the Telegraf/Jolokia2 plugin required a Java JAR file to also be installed and run with Cassandra – I just thought ‘jolokia2’ was the (odd) name for the new Telegraf Cassandra plugin. I was trying to point the url to the localhost:7199 address that Cassandra uses to expose metrics.