Ad Widget

Collapse

Monitoring Tomcat using JMX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rimelalami
    Junior Member
    • Aug 2017
    • 4

    #1

    Monitoring Tomcat using JMX

    Hello everyone!
    I found problems to monitor tomcat installed in ubuntu.
    I have zabbix-server installed in an ubuntu server and I want to monitor tomcat server installed in the same host using JMX.
    -I've installed java gateway in my zabbix-server machine.
    -I've confiured java gateway file located in : /etc/zabbix/zabbix_java_gateway.conf
    LISTEN_IP="127.0.0.1"
    LISTEN_PORT=10052
    START_POLLERS=5

    -I've configured zabbix_server.config , and added:
    JavaGateway=127.0.0.1
    JavaGatewayPort=10052
    StartJavaPollers=5

    -I added these lines in tomcat.conf(/etc/tomcat/tomcat.conf) file:
    JAVA_OPTS="Dcom.sun.management.jmxremoteDcom.sun.m anagement.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false Dcom.sun.management.jmxremote.ssl=false"

    - In the zabbix web frontend that what I did:
    IP : 127.0.0.1 ; Port : 10052
    That's all what I did I don't know where I went wrong
    I work with zabbix for my internship; so I'm new at zabbix.
    Thank you
  • kasik
    Member
    • Aug 2017
    • 30

    #2
    Java_opts

    Originally posted by rimelalami
    Hello everyone!
    I found problems to monitor tomcat installed in ubuntu.
    I have zabbix-server installed in an ubuntu server and I want to monitor tomcat server installed in the same host using JMX.
    -I've installed java gateway in my zabbix-server machine.
    -I've confiured java gateway file located in : /etc/zabbix/zabbix_java_gateway.conf
    LISTEN_IP="127.0.0.1"
    LISTEN_PORT=10052
    START_POLLERS=5

    -I've configured zabbix_server.config , and added:
    JavaGateway=127.0.0.1
    JavaGatewayPort=10052
    StartJavaPollers=5

    -I added these lines in tomcat.conf(/etc/tomcat/tomcat.conf) file:
    JAVA_OPTS="Dcom.sun.management.jmxremoteDcom.sun.m anagement.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false Dcom.sun.management.jmxremote.ssl=false"

    - In the zabbix web frontend that what I did:
    IP : 127.0.0.1 ; Port : 10052
    That's all what I did I don't know where I went wrong
    I work with zabbix for my internship; so I'm new at zabbix.
    Thank you
    Hey,
    i'm not so sure, but first problem i see is in your JAVA_OPTS first paramets missing -, then as remote port u defined on Java gateway 10052 but in command you used 12345, and what else i had to add into options is
    -Djava.rmi.server.hostname=IPoFYourTomCatServer
    if this is not enought then try add this
    -Dcom.sun.management.jmxremote.rmi.port=10052

    Comment

    • rimelalami
      Junior Member
      • Aug 2017
      • 4

      #3
      Thank you very much for your respond

      That's what I've changed in my tomcat.conf file, but it still doesn't work, do you know please where I went wrong
      Code:
      JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.rmi.port=10052 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=myIPaddress "

      Comment

      • allexpetrov
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2017
        • 361

        #4
        Originally posted by rimelalami
        Thank you very much for your respond

        That's what I've changed in my tomcat.conf file, but it still doesn't work, do you know please where I went wrong
        Code:
        JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.rmi.port=10052 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=myIPaddress "
        Hi rimelalami!

        So the 12345 is a local port for fetching metrics from Tomcat and the 10052 is the port for communication between Zabbix Server/Proxy and Java Gateway. It think that the problem is that your Host is configured to listen localhost:10052 which appears to be your Java Gateway and not a Tomcat.

        Basically, if those are separate machines, then it looks like ZBX <-10052-> Java gateway <-12345-> Tomcat

        Try to change back to default port (12345) in your host config and change back it in your tomcat.conf file.

        By the way, sometimes log file of the zabbix server would be pretty useful. If you have any errors out there - check & paste here (sudo tail -f /var/log/zabbix/zabbix_server.log)

        Also, check if the ports are opened with command netstat -tulpn , can you see port 12345 (the one which is defined in tomcat.conf) ?

        P.S. - I would like to ask you to set back to defaults your Java Gateway config file, just to make sure that everything is correct for now.

        Regards,
        Alexey!

        Comment

        • Atsushi
          Senior Member
          • Aug 2013
          • 2028

          #5
          For the host's JMX interface, specify the IP address and port number of the server that started Tomcat.

          ex. JMX interface
          Code:
          IP address : 192.168.1.1
          Port No : 12345

          Comment

          • Nasibulloh Yandashev
            Junior Member
            • Jan 2019
            • 5

            #6
            I used Zabbix JMX with Spring Boot project with embedded Tomcat. It worked but, I could not see Catalina metrics. Especially I needed to monitor "Tomcat's received and sent bytes". But many Catalina metrics did not work. I don't know why Catalina metrics is not working? I asked in many resources. For example https://stackoverflow.com/questions/...38412_54308393 and https://stackoverflow.com/questions/...67501_54476874

            Comment

            • Nasibulloh Yandashev
              Junior Member
              • Jan 2019
              • 5

              #7
              Maybe should I need to configure tomcat, or Zabbix template?

              Comment

              Working...