Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries
through a c program or java program

i want to store that data into database so i can show it graphically

thanks in advance

to find cpu and memory usage ...

man top

to find the hard disk usage : for different file systems,

man df
man du

and to execute these unix commands through C program ... use system() library function...