9

newbie here. I have a java application and I am working on to monitor that java application. I come to know about the java monitoring and management control using 'JConsole'. It giving a very detailed graphical information about the running java process.

but the thing I am wondering is about the data used to generate the graphs. As in JConsole we can save the data in csv format by right clicking on running graph, Is there any command line option to get the data only in csv format.

Space
  • 7,049
  • 6
  • 49
  • 68

3 Answers3

7

The command-line options for JConsole are only for starting JConsole, not for exporting its results.

The only way to get data from JConsole would be through JMX MBeans as suggested in this SO answer, but you would need to write those data in CSV format yourself.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @Octopus: I am not sure. This is quite Java-centric. – VonC Jan 15 '10 at 09:59
  • @VonC: Thanks, Can you please also suggest me if there is any other tool from where I can get the similar data information. – Space Jan 15 '10 at 11:12
3

Google some client examples. Here's a quick one.

I've recently done exactly what you've described. It wasn't much work. One tip that cost me some time. If you are working with DynamicMBeans, the bean attachment approach in nearly every example I found won't work. You have to directly reference each value. See this question (mine)

Community
  • 1
  • 1
Jim Rush
  • 4,143
  • 3
  • 25
  • 27
2

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

You can use its STDOUT as an input for further processing.

Example output:

 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
MRalwasser
  • 15,605
  • 15
  • 101
  • 147