Can i read the htop output in my java code?

1.5k Views Asked by At

I require to read information about various processes that are running in my server and values of certain parameters. Im trying to use Apache server on Ubuntu 11.10. using htop in terminal i get to see the processes and variable values. i tried re-directing the output by piping to a text file but it didn't help. Could u help by telling how reading its output through java code is possible. I'm new to java help me out.

1

There are 1 best solutions below

0
On

You might want to look at the linux /proc file system: there you will find mostly all information about the system and running processes. Typically tools like ps or top read their data from there. A lot of files are small text files where you can get the appropriate information from.

An introduction (somewhat old but a good introduction) you can find under http://www.linuxjournal.com/article/8381

Additional note: the /proc file system is somewhat documented and stable. Mostly all tool output might (will) change over time.