0

I was thinking about capturing some metrics from a JVM like max/min/used memory, cpu consumption and maybe more later on.

I did some research but couldn't find anything that would be suitable.

Could one please direct me to the right reading, where to start ?

Please note, I am not looking for any kind of software which is out there on the market rather about reading materilas how to programatically get metrics via JMX so, I am able to store these in DB or a file.

m1k3y3
  • 2,762
  • 8
  • 39
  • 68

2 Answers2

2

There is a very nice article from IBM: http://www.ibm.com/developerworks/library/j-rtm1/index.html?ca=dgr-jw22javaruntime1&S_TACT=105AGX59&S_CMP=GR

It has three parts and containing detail information and explanation.

Part 1:

Explores attributes of application performance management (APM) systems
Describes common antipatterns for system monitoring
Presents methods for monitoring the performance of JVMs
Offers techniques for efficiently instrumenting application source code

Part 2 will focus on methods of instrumenting Java classes and resources without modification of the originating source code. 
Part 3 will address methods for monitoring resources outside the JVM, including hosts and their operating systems and remote services such as databases and messaging systems. It will conclude with a discussion of additional APM issues such as data management, data visualization, reporting, and alerting.
Don
  • 555
  • 3
  • 12
1

Check out the JMX stats available and how to monitor them using JConsole. Lots of stats are available by default (garbage collection info, memory pools, thread-stats). CPU is a little trickier but check out this SO question for more details.

Note that you don't have to use just JConsole. You can easily write your own monitor to collate these stats.

Community
  • 1
  • 1
Brian Agnew
  • 268,207
  • 37
  • 334
  • 440