Can jconsole data be retrieved from the command line?

前端 未结 9 2086
耶瑟儿~
耶瑟儿~ 2020-12-05 17:21

I am currently using jconsole to monitor performance metrics of my Java application and would like to script this data acquisition

相关标签:
9条回答
  • 2020-12-05 17:46

    Some other useful CLI tools to monitor a Java applications are:

    • Jmxterm which gives full access to all MBeans on the application server, runs interactively or not,
    • jmxbox which can only connect through a TCP socket, not directly to a local process with its PID
    0 讨论(0)
  • 2020-12-05 17:47

    You might find jvm-mon useful for this. It is a JVM monitoring tool for the command line that disaplys:

    • jvm processes
    • cpu and GC usage
    • heap usage and size
    • top threads

    The metrics and charts update while the tool is open.

    Sample:

    0 讨论(0)
  • 2020-12-05 17:49

    Take a look at jmap, which can be used to take a heap dump from the console.

    For data not covered in the heap dump, I believe jconsole just uses JMX to connect to the running JVM to get statistics - so it's likely possible to create your own application which could pull those same types of stats from JMX.

    0 讨论(0)
  • 2020-12-05 17:52

    You can use this jmx query tool by command line: http://crawler.archive.org/cmdline-jmxclient/

    0 讨论(0)
  • 2020-12-05 17:59

    Maybe jvmtop is worth a look.
    It's a command-line tool which provides a live-view for several metrics.

    Example output of the VM overview mode:

     JvmTop 0.4.1  amd64  8 cpus, Linux 2.6.32-27, load avg 0.12
     http://code.google.com/p/jvmtop
    
      PID MAIN-CLASS      HPCUR HPMAX NHCUR NHMAX    CPU     GC    VM USERNAME   #T DL
     3370 rapperSimpleApp  165m  455m  109m  176m  0.12%  0.00% S6U37 web        21
    11272 ver.resin.Resin [ERROR: Could not attach to VM]
    27338 WatchdogManager   11m   28m   23m  130m  0.00%  0.00% S6U37 web        31
    19187 m.jvmtop.JvmTop   20m 3544m   13m  130m  0.93%  0.47% S6U37 web        20
    16733 artup.Bootstrap  159m  455m  166m  304m  0.12%  0.00% S6U37 web        46
    
    0 讨论(0)
  • 2020-12-05 18:01

    jstack offers a number of useful bits of information in its normal output. Heap memory usage is directly available, broken down by GC region; thread count could be determined with a little bit of perl / grep / etc.

    0 讨论(0)
提交回复
热议问题