Ad Widget

Collapse

jmx keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pradhanparas
    Member
    • Jul 2012
    • 45

    #1

    jmx keys

    Hi,

    I was able to make java gateway work to monitor java. In the documentation I dont see the possbile key parameters except this

    jmx["java.lang:type=Memory","HeapMemoryUsage.used"]

    I would like to get the values for

    Eden used/free
    Survivor used/free
    Old used/free
    Permanent used/free

    Where do i refer?

    Thanks
    Paras.
    Last edited by pradhanparas; 30-10-2012, 17:35.
  • Slash
    Member
    • May 2011
    • 64

    #2
    See step 5 in my post here to find the correct bean name with jmxterm : http://www.zabbix.com/forum/showthread.php?t=36714

    For the classic memory pool, just create items like this :

    jmx["java.lang:type=MemoryPool,name=CMS Old Gen",Usage.committed]
    jmx["java.lang:type=MemoryPool,name=CMS Old Gen",Usage.init]
    jmx["java.lang:type=MemoryPool,name=CMS Old Gen",Usage.max]
    jmx["java.lang:type=MemoryPool,name=CMS Old Gen",Usage.used]

    Just change "CMS Old Gen" by "CMS Perm Gen", "Code Cache", "Par Eden Space", "Par Survivor Space" and you'll have all the memory pool monitored ;-)

    Comment

    • pradhanparas
      Member
      • Jul 2012
      • 45

      #3
      Thanks for your reply slash


      I am not sure why but all of the CMS old gen.* , Par Eden and Par Survivor Space are greyed out and says not supported.

      Any idea why?

      I have PS old Gen. * working though.

      Thanks in advance
      Paras.

      Comment

      • Slash
        Member
        • May 2011
        • 64

        #4
        This simply means that you have different beans than me.

        Use jmxterm to determine what beans you have and want to monitor (use google to download it).

        For example, I found my beans this way :

        Code:
        # java -jar jmxterm-1.0-alpha-4-uber.jar 
        $>open example.com:77777
        #Connection to example.com:77777 is opened
        $>domains
        #following domains are available
        Catalina
        JMImplementation
        Users
        axis
        com.sun.management
        java.lang
        java.nio
        java.util.logging
        $>domain java.lang         
        #domain is set to java.lang
        $>beans
        #domain = java.lang:
        java.lang:name=CMS Old Gen,type=MemoryPool
        java.lang:name=CMS Perm Gen,type=MemoryPool
        java.lang:name=Code Cache,type=MemoryPool
        java.lang:name=CodeCacheManager,type=MemoryManager
        java.lang:name=ConcurrentMarkSweep,type=GarbageCollector
        java.lang:name=Par Eden Space,type=MemoryPool
        java.lang:name=Par Survivor Space,type=MemoryPool
        java.lang:name=ParNew,type=GarbageCollector
        java.lang:type=ClassLoading
        java.lang:type=Compilation
        java.lang:type=Memory
        java.lang:type=OperatingSystem
        java.lang:type=Runtime
        java.lang:type=Threading
        $>bean java.lang:name=CMS\ Old\ Gen,type=MemoryPool 
        #bean is set to java.lang:name=CMS Old Gen,type=MemoryPool
        $>info
        #mbean = java.lang:name=CMS Old Gen,type=MemoryPool
        #class name = sun.management.MemoryPoolImpl
        # attributes
          %0   - CollectionUsage (javax.management.openmbean.CompositeData, r)
          %1   - CollectionUsageThreshold (long, rw)
          %2   - CollectionUsageThresholdCount (long, r)
          %3   - CollectionUsageThresholdExceeded (boolean, r)
          %4   - CollectionUsageThresholdSupported (boolean, r)
          %5   - MemoryManagerNames ([Ljava.lang.String;, r)
          %6   - Name (java.lang.String, r)
          %7   - ObjectName (javax.management.ObjectName, r)
          %8   - PeakUsage (javax.management.openmbean.CompositeData, r)
          %9   - Type (java.lang.String, r)
          %10  - Usage (javax.management.openmbean.CompositeData, r)
          %11  - UsageThreshold (long, rw)
          %12  - UsageThresholdCount (long, r)
          %13  - UsageThresholdExceeded (boolean, r)
          %14  - UsageThresholdSupported (boolean, r)
          %15  - Valid (boolean, r)
        # operations
          %0   - void resetPeakUsage()
        #there's no notifications
        $>get Usage
        #mbean = java.lang:name=CMS Old Gen,type=MemoryPool:
        Usage = { 
          committed = 25666686976;
          init = 1409286144;
          max = 126842503168;
          used = 20070232200;
         };
        Meaning that a bean named "java.lang:name=CMS Old Gen,type=MemoryPool" exist with an "usage" parameter with 4 value, so the jmx value I want is finally "java.lang:name=CMS Old Gen,type=MemoryPool,usage.committed/init/max/used".

        Anyway, just look arround with jmxterm and you'll find what you want to monitor, there is no mystery here ;-)

        Comment

        • pradhanparas
          Member
          • Jul 2012
          • 45

          #5
          jmxterm helped me to find out the correct beans. Thank you very much Slash !

          One last question, I could see

          java.lang:name=PS Survivor Space,type=MemoryPool

          Aren't there Survivor0 and Survivor1? By looking at the output from the above bean, I see Free from S0 and Used from S1.

          Thanks!
          Paras.


          beans o/p:

          java.lang:name=Code Cache,type=MemoryPool
          java.lang:name=CodeCacheManager,type=MemoryManager
          java.lang:name=PS Eden Space,type=MemoryPool
          java.lang:name=PS MarkSweep,type=GarbageCollector
          java.lang:name=PS Old Gen,type=MemoryPool
          java.lang:name=PS Perm Gen,type=MemoryPool
          java.lang:name=PS Scavenge,type=GarbageCollector
          java.lang:name=PS Survivor Space,type=MemoryPool
          java.lang:type=ClassLoading
          java.lang:type=Compilation
          java.lang:type=Memory
          java.lang:type=OperatingSystem
          java.lang:type=Runtime
          java.lang:type=Threading

          Comment

          • Slash
            Member
            • May 2011
            • 64

            #6
            Sorry but I have no idea

            I don't have survivor0 and survivor1 on my beans, which seems logical since there is only one survivor memory pool.

            Or maybe I misunderstood you?

            Comment

            • Tec_Technician
              Member
              • Dec 2015
              • 39

              #7
              Help for future

              Hi all!!

              I know this thread is old but i have another way to help, and I think that could help for future search on the forum:

              If you are not sure about what Mbeans you have, you can install Java VisualVM and download and active the plugin MBeans, so you could see the list of MBeans in a folder tree, easy to check the route and the ObjectName.

              Hope this could help.

              Best regards,




              Number of hosts 50,Number of items +3600,Number of triggers +1500. Zabbix beginner.

              Comment

              • Slash
                Member
                • May 2011
                • 64

                #8
                Yes, this topic is old... I don't know about JAVA Visual VM but we now simply use jconsole, which is bundled with OpenJDK and Oracle JDK.

                You just need to start the target JVM with this kind of option:
                Code:
                -Dcom.sun.management.jmxremote
                -Dcom.sun.management.jmxremote.port=12345
                -Dcom.sun.management.jmxremote.ssl=false
                -Dcom.sun.management.jmxremote.authenticate=false
                You may also need this, depending on the configuration of you server/dns:
                Code:
                -Djava.rmi.server.hostname=server_FQDN_here
                This is the simplest configuration (do not use in prod since it doesn't ask for a password).

                You may also add a password authentication with:
                Code:
                -Dcom.sun.management.jmxremote.authenticate=true
                -Dcom.sun.management.jmxremote.access.file=path_to_an_access_file
                -Dcom.sun.management.jmxremote.password.file=path_to_a_password_file
                Look at the official JAVA configuration to create correct files for access and password.

                Comment

                Working...