Hi, According to FreeBSD man pages [sysctl(3)] the sysctl() is about three times faster than the sysctlbyname(), and it didn't need that much more work.
Toni On Wednesday 01 June 2011 19:16:36 Kimo Rosenbaum wrote: > Hi, > > I started working on a sysctl plugin but never got that far. Just curious, > why did you go with sysctlnametomib() versus sysctlbyname()? > > Thanks > Kimo > > > > ----- Original Message ---- > > > From: Toni Ylenius <toniylen...@gmail.com> > > To: collectd@verplant.org > > Sent: Tue, May 31, 2011 2:16:18 AM > > Subject: [collectd] [PATCH] Simple sysctl plugin > > > > Hi, > > > > 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 > > > > FreeBSD. > > > > 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> > > > > <Entry "dev.cpu.1.temperature"> > > > > Type "fbsd_temp" > > Instance "cpu-1" > > > > </Entry> > > > > </Plugin> > > > > 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> > > > > <Entry "kstat.zfs.misc.arcstats.l2_size"> > > > > Instance "l2_size" > > Type "gauge" > > > > </Entry> > > ... etc ... > > > > </Plugin> > > > > 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 _______________________________________________ collectd mailing list collectd@verplant.org http://mailman.verplant.org/listinfo/collectd