Hi, I'm developing C plugin for Centos which will be installed as kernel module. The problem is how to collect the data about:
none of that stuff should be in a kernel module. a simple daemon is far more appropriate.
What is the most appropriate way to do this task? What are the benefits of the kernel module and daemon?
Peter
On 12/24/10 4:45 PM, derleader __ wrote:
Hi, I'm developing C plugin for Centos which will be installed as kernel module. The problem is how to collect the data about:
none of that stuff should be in a kernel module. a simple daemon is far more appropriate.
What is the most appropriate way to do this task?
What do you plan to do with the data? On the local host most is already available through the /proc interface (things that look like files to user programs) and tools already exist to read and display the values. If you want to collect data from remote hosts, snmp is the appropriate protocol and again, tools already exist.
What are the benefits of the kernel module and daemon?
Normally kernel modules would only be used to communicate with specific hardware (and errors introduce the risk of crashing). Everything you mention is already available without kernel changes, although some might be reported in less than optimal ways.
On 12/24/10 2:45 PM, derleader __ wrote:
Hi, I'm developing C plugin for Centos which will be installed as kernel module. The problem is how to collect the data about:
none of that stuff should be in a kernel module. a simple daemon is far more appropriate.
What is the most appropriate way to do this task?
see my prior response. A daemon is simply a usermode process thats started when the system boots and runs as a dedicated service. In CentOS, these are normally started via init.d scripts and the Sys V init subsystem.
but as others have pointed out there are numerous implementations of this already. Also, in addition to the programmatic data sources I mentioned, much of the more realtime sort of data (cpu load, network traffic, etc) is available via SNMP which can be queried over a network from a data collection server, once its configured.
I wouldn't query the more 'inventory' sorts of data more than once a day, the number of CPUs and the hardware doesn't change very often, recording this every 5 minutes would be excessive.
What are the benefits of the kernel module and daemon?
I know of no benefits of using a kernel module to perform what is readily doable in usermode. kernel modules should be reserved for things like device drivers, low level network components, file systems, and so forth. If a kernel module faults, it brings down the whole system catastrophically. a usermode daemon process would just terminate, and everything else would continue running. A daemon can run as whatever security context is appropriate for it to do its job. Most of what you described doesn't even need root privileges, but some may (lshw I believe won't be able to collect as much info if its not run as root)