[collectd] [PATCH] Simple sysctl plugin

Toni Ylenius toniylenius at gmail.com
Tue May 31 11:16:18 CEST 2011


I have written a simple sysctl plugin.

Initially I wanted to create a general sysctl plugin, but I ended up writing a 
simple plugin that reads integer values from sysctl. The plugin relies on the 
sysctlnametomib function (that is very similar to the sysctlnametomib) and 
should work on BSD like systems (Mac OS X?). I have tested the plugin only on 

For example one can get temperature statistics with
<Plugin sysctl>
	Instance "coretemp"
	<Entry "dev.cpu.0.temperature">
		Type "fbsd_temp" # Real value = (fbsd_temp - 2732)/10.0
		Instance "cpu-0"
	<Entry "dev.cpu.1.temperature">
		Type "fbsd_temp"
		Instance "cpu-1"

or ZFS arc statistics (like the ZFS ARC plugin)
<Plugin sysctl>
	Instance "zfs-arc"
	<Entry "kstat.zfs.misc.arcstats.size">
		Instance "arc_size"
		Type "gauge"
	<Entry "kstat.zfs.misc.arcstats.l2_size">
		Instance "l2_size"
		Type "gauge"
	... etc ...

This plugin has proven useful for me and I wanted to share it. However it 
currently supports only integer sysctl values. A patch in the attachment is 
against collectd version 5.0.0.

I'm quite new in open source contribution, so feel free to comment my code.

Toni Ylenius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysctl_v0.patch
Type: text/x-patch
Size: 14810 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110531/90bbe5a2/attachment.bin>

More information about the collectd mailing list