Write Linux kernel module to collect data from the kernel

Issues related to applications and software problems
Post Reply
rcbandit
Posts: 10
Joined: 2011/03/18 21:36:59
Contact:

Write Linux kernel module to collect data from the kernel

Post by rcbandit » 2011/09/13 07:40:38

Hi,
I want to write a Linux kernel module which collects the CPU, RAM and HDD load. I can write a simple kernel module but I don't have any idea where where to find the data from the kernel I need. Can you help me and point me where I can find in the kernel those data?

Regards
Peter

User avatar
TrevorH
Forum Moderator
Posts: 29457
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Write Linux kernel module to collect data from the kernel

Post by TrevorH » 2011/09/13 08:36:56

All that information is already available in /proc and various utilities use it including top, sar, vmstat and iostat.

rcbandit
Posts: 10
Joined: 2011/03/18 21:36:59
Contact:

Re: Write Linux kernel module to collect data from the kernel

Post by rcbandit » 2011/09/13 09:45:10

Yes. But /proc in my case is not a solution

r_hartman
Posts: 706
Joined: 2009/03/23 15:08:11
Location: Netherlands
Contact:

Write Linux kernel module to collect data from the kernel

Post by r_hartman » 2011/09/13 09:56:32

So? Why not? Please elaborate.

rcbandit
Posts: 10
Joined: 2011/03/18 21:36:59
Contact:

Re: Write Linux kernel module to collect data from the kernel

Post by rcbandit » 2011/09/13 10:06:47

I need a solution that can be deployable in every Linux distribution.
As far as I know /proc in different architectures is different. And sometimes is missing.

User avatar
TrevorH
Forum Moderator
Posts: 29457
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Write Linux kernel module to collect data from the kernel

Post by TrevorH » 2011/09/13 11:41:37

/proc comes from the kernel and is likely to be constant across distributions. Across [u]architectures[/u] it is probably the same but I don't use anything except Intel/AMD so cannot swear to this. Chances are that if it is then you kernel module would need to be different too.

Post Reply

Return to “CentOS 6 - Software Support”