Ad Widget

Collapse

JMX Garbage Collection monitoring on Docker Container

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nlsteffens
    Junior Member
    • Dec 2022
    • 4

    #1

    JMX Garbage Collection monitoring on Docker Container

    Hello,

    I have a Docker Container running Java 11 and I'm attempting to get Garbage Collection metrics via JMX. I'm able to get other metrics from the container like Heap Memory but unfortunately Garbage Collection isn't working and I get a message saying 'Object or Attribute not found' in my Zabbix items.

    The Garbage Collection metrics are working on non-dockerised containers running springboot and tomcat on Java 8.

    I'm running Zabbix version 4.0.11 and the Docker container is running on a server running CentOS 7.7

    These are the garbage collection strings that Zabbix is using. Perhaps the strings should be different for Java 11?

    jmx["java.lang:type=GarbageCollector,name=ConcurrentMa rkSweep","CollectionCount"]
    jmx["java.lang:type=GarbageCollector,name=Copy","Colle ctionTime"]
    jmx["java.lang:type=GarbageCollector,name=Copy","Colle ctionCount"]
    jmx["java.lang:type=GarbageCollector,name=MarkSwee pCom pact","CollectionTime"]
    jmx["java.lang:type=GarbageCollector,name=MarkSwee pCom pact","CollectionCount"]
    jmx["java.lang:type=GarbageCollector,name=ParNew","Col lectionTime"]
    jmx["java.lang:type=GarbageCollector,name=ParNew","Col lectionCount"]
    jmx["java.lang:type=GarbageCollector,name=PS MarkSweep","CollectionTime"]
    jmx["java.lang:type=GarbageCollector,name=PS MarkSweep","CollectionCount"]
    jmx["java.lang:type=GarbageCollector,name=PS Scavenge","CollectionTime"]
    jmx["java.lang:type=GarbageCollector,name=PS Scavenge","CollectionCount"]

    This is the JDK_JAVA_OPTIONS string I'm using in the cotainer. The hostname has been replaced by a dummy IP address:

    JDK_JAVA_OPTIONS=-Xlog:gc*,safepoint:file=/app/logs/gc.log:time,level,tags:filecount=10,filesize=10M -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8000 -Dcom.sun.management.jmxremote.rmi.port=8000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=10.10.10.10

    Any help would be appreciated.

    Regards,
    Nick




















    Attached Files
  • Answer selected by nlsteffens at 28-03-2023, 08:20.
    nlsteffens
    Junior Member
    • Dec 2022
    • 4

    As of Java 7 update 4, the garbage collector used is G1. This means the strings used to get the garbage collection metrics have changed. Use the strings below to gather the metrics in Zabbix.

    G1 Old Generation:
    jmx["java.lang:type=GarbageCollector,name=G1 Old Generation",CollectionCount]
    jmx["java.lang:type=GarbageCollector,name=G1 Old Generation",CollectionTime]

    G1 Young Generation:
    jmx["java.lang:type=GarbageCollector,name=G1 Young Generation",CollectionCount]
    jmx["java.lang:type=GarbageCollector,name=G1 Young Generation",CollectionTime]

    A list of the G1 collection metrics can be found in the template here: https://wiki.liutyi.info/display/DEV...oring+template

    Comment

    • nlsteffens
      Junior Member
      • Dec 2022
      • 4

      #2
      As of Java 7 update 4, the garbage collector used is G1. This means the strings used to get the garbage collection metrics have changed. Use the strings below to gather the metrics in Zabbix.

      G1 Old Generation:
      jmx["java.lang:type=GarbageCollector,name=G1 Old Generation",CollectionCount]
      jmx["java.lang:type=GarbageCollector,name=G1 Old Generation",CollectionTime]

      G1 Young Generation:
      jmx["java.lang:type=GarbageCollector,name=G1 Young Generation",CollectionCount]
      jmx["java.lang:type=GarbageCollector,name=G1 Young Generation",CollectionTime]

      A list of the G1 collection metrics can be found in the template here: https://wiki.liutyi.info/display/DEV...oring+template

      Comment

      Working...