sarma1807 / Prometheus-Grafana-Cassandra

Prometheus & Grafana for Cassandra
25 stars 14 forks source link

Error occurred during initialization of VM - CassPromFileExporter-j17-all.jar #4

Open baileygm opened 2 months ago

baileygm commented 2 months ago

Hi Sarma This approach for monitoring Cassandra 5 metrics is of great interest to me but I keep getting java errors when trying to implement it I'm running Cassandra using a docker image based on version 5.0-rc2

I have downloaded the jar file to /opt/cassandra/lib and set the environment variable

JVM_EXTRA_OPTS="-javaagent:/opt/cassandra/lib/CassPromFileExporter-j17-all.jar"

When I try and start Cassandra it exits with errror

Error opening zip file or JAR manifest missing : /opt/cassandra/lib/CassPromFileExporter-j17-all.jar Error occurred during initialization of VM agent library failed to init: instrument

This is the java environment used

java -version openjdk version "17.0.12" 2024-07-16 OpenJDK Runtime Environment Temurin-17.0.12+7 (build 17.0.12+7) OpenJDK 64-Bit Server VM Temurin-17.0.12+7 (build 17.0.12+7, mixed mode, sharing)

Have I missed some step ?

sarma1807 commented 2 months ago

I have noticed that when using Java 17 initially during library load / Cassandra startup might be throwing one unhandled exception, but within next 5 minutes it is working fine and dumping metrics.

you can verify by looking for / at following file (metrics will be written to file every 5 minutes) : /tmp/oramad_cass_prom_metrics_0.txt

please verify and confirm if you are getting new metrics written into above file.

baileygm commented 1 month ago

In my case where I am running Cassandra in a docker container the java exception causes cassandra to exit

baileygm commented 1 month ago

It seems that if I embed the addition of the library and config changes in my docker image definition then Cassandra fails to start whereas if I add them to the running container afterwards and restart the container then it works.

So I can add the configs to docker-entrypoint.sh as a workaround and move forwards with experimentation