3

I am using Zabbix for monitoring metrics, I have a Java Spring application and I want to see all metrics such as Tomcat's metrics. When I use Zabbix for monitoring, some items of Zabbix are not working. Especially Catalina support. I tried to see Catalina metrics on Jconsole, but I did receive any data. I don't know where I should add any libraries or components in order to get metrics.

I configured Spring Jmx, Rmi beans. But anyway I have not found any answers. It did not help me to solve the problem. I used this recource. Unfortunately, I could not solve my problem.

I tried to add this.

<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat-catalina-jmx-remote</artifactId>
    <version>8.5.9</version>
    <type>jar</type>
</dependency>

Before running the server I added

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port= -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=

I expect that monitoring tomcat should be worked without any additional codes, But It is not working. Basically, I need Tomcat's received and sent bytes. How should I do this?

  • Did you add `catalina-jmx-remote.jar` in your lib directory as said in [Tomcat documentation](http://tomcat.apache.org/tomcat-8.5-doc/config/listeners.html#JMX_Remote_Lifecycle_Listener_-_org.apache.catalina.mbeans.JmxRemoteLifecycleListener) ? It's something obvious but not said in the question you mentionned. – Eugène Adell Feb 01 '19 at 10:47
  • This one `-Dcom.sun.management.jmxremote` is deprecated since Java 1.6. See [Monitoring and Management Using JMX Technology](https://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html) if you need official doc. – Eugène Adell Feb 01 '19 at 10:59
  • Check _jps_ can see your JVM with `jps -lv` or remotely `jps -lv YourTomcatServer`. If it doesn't work remotely, you have a firewall to open. In this case use the _Listener Valve_ (see my first link) with two ports of your choice that you will open on the firewall, and also these 2 properties only `-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false` . Properties are ideally set in `setenv.sh`. Once this works, you can enable authentication first, and SSL later if you want to add some security. – Eugène Adell Feb 01 '19 at 13:15
  • I added __catalina-jmx-remote.jar__ in maven dependency. The project is built with spring and tomcat embedded into spring boot. I just run the *.jar file command line with parameters above. I launched JConsole and Zabbix. But Neither in Jconsole nor in Zabbix. I could not find Tomcat's recived and sent bytes. I saw that an item Catalina's GlobalRequestProcessor was not working on Zabbix – Nasibulloh Yandashev Feb 12 '19 at 10:52
  • I disabled all firewalls on ubuntu and run the project with no authentication. Like this. `-Dcom.sun.management.jmxremote.authenticate=false` `- Dcom.sun.management.jmxremote.ssl=false` – Nasibulloh Yandashev Feb 12 '19 at 10:53
  • catalina-jmx-remote.jar should be in Tomcat's own lib directory, not as a webapp dependency (webapps/yourapp/WEB-INF/lib) which is probably what you get by adding it in maven. This is quite clear in the documentation, where to put this jar. – Eugène Adell Feb 12 '19 at 12:39

0 Answers0