[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Collecting data

This list is for discussion of development *of* Debian, not *on* Debian.

On Fri, 2010-12-24 at 17:41 +0200, derleader __ wrote:
> Hi,
>      I'm developing C plugin for Debian which will be installed as
> kernel module.

I would advise against doing that, as it will be easier to obtain this
information from userland.

> The problem is how to collect the data about: 
>       * CPU Check – Utilization, Model, Number of Cores

See /proc/stat (utilisation) and /proc/cpuinfo (the rest).

>       * RAM Check – Total Memory, Free Memory, Memory Load

See /proc/meminfo.

>       * HDD Check – Number of physical HDDs, Number of logical
>         partitions, Total space, Free space

See /sys/block and the statvfs() system call.

>       * Running processes – Total number of processes

See /proc.

>       * Logs – system logs such as error logs

Kernel log is accessible using klogctl().  The general logs are
under /var/log and are configurable by the administrator.

>       * System uptime

See /proc/uptime.

>       * Users logged in and last login – total list of users

See manual page utmp(5).

>       * Total network connections

See /proc/net/tcp, /proc/net/udp, etc.

>       * Check hardware parts model and number

Some information is under /sys/devices/virtual/dmi/id.  Otherwise look
at what the 'lshw' command does.

> The kernel module will check the status of the OS every 5 minutes.
> What is the most efficient way to collect these data?

Don't try to list the hardware every 5 minutes!  The rest should be
fairly cheap to scan.


Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: