开发者

How can i monitor system statistics in kubuntu using Java?

i am doing a project related to configuration and memory analyzer for kubuntu. i want to display the system statistics information like CPU usage, RAM usage and proceses etc. graphically using an odometer. i wanted to k开发者_如何学运维now if there is any great open source library for graphical component like odometers and other graphing utilities. also another problem is that i have to get information of cpu from somewhere and parse it and feed it into the odometer for display. one method may be that i use command line utilities and parse the results and feed to the graphical component. another option is that there is a library called libstatgrab which is written in complete C and i need to use JNI.

i dont like both these approaches because i am a little short on time and need a library that can do these things for me. there is a binding library present for Python to libstatgrab but not to java. and if any one has any other approach, please write up.


For collecting the statistics, I would read directly from /proc or /sys, since they're just text files which are readily parseable (slightly moreso than exec()ing a command line tool and reading its output). Look at /proc/meminfo, /proc/loadavg, /proc/stat and others.

You can look at the C source of the procps package to see how these files are worked with by running

apt-get source procps

In there, you can look at how top.c reads the /proc/stat file.

As for charting, the "bog standard" plotting library is JFreeChart.


there is a binding library present for Python to libstatgrab but not to java

Use jython?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜