views:

45

answers:

2

hi,

i wrote a little test programm which queries the status servlet of a tomcat an fetches the memory information of the jvm (free,total,max). Is there a way to get more information ? Like CPU, memory of the process, system memory and so on. I know that some of these things may possible to get somehow because there are tools (e.g. probe) which can fetch more information. What i want to achieve is to build maybe an ant task which i can call(is there maybe an better approach or already something ready to use?), which log's as much information for the time being. Any information/help would be appreceated. Thanks.

kukudas

+1  A: 

You can't do it with only the base libraries, but you can get all you want and more with the SIGAR API. Some examples of things you can get:

  • System memory, swap, cpu, load average, uptime, logins
  • Per-process memory, cpu, credential info, state, arguments, environment, open files
  • File system detection and metrics
  • Network interface detection, configuration info and metrics
  • TCP and UDP connection tables
  • Network routing tables
John Feminella
You know of a similar lib with a apache licence?
kukudas
SIGAR is licensed under GPL v3, which is compatible with Apache licensing.
John Feminella
Don't i have to licence my software also under GPL if i use a lib which is GPL ?
kukudas
+1  A: 

You can pull out a great deal using JMX , Tomcat has some docs on how to enable JMX, and also ant tasks for querying the management beans.

Try hook up jconsole to Tomcat after you've enabled JMX, you can browse all the management information available from a GUI.

nos