[collectd] [PATCH] -T option

Doug MacEachern Doug.MacEachern at hyperic.com
Fri Jan 2 23:21:45 CET 2009


With the attached patches, you can do a quick test of your plugin read
function like so:
./src/collectd -T -C ~/test/myplugin.conf

Example config:
BaseDir     "."
PluginDir   "src/.libs"
TypesDB     "src/types.db"

LoadPlugin logfile

<Plugin logfile>
        LogLevel debug
        File "stderr"
</Plugin>

LoadPlugin csv
<Plugin csv>
        DataDir "stdout"
</Plugin>

LoadPlugin myplugin

The -T switch:
- implies -f
- does not start any read threads
- invokes callback() foreach list_read and will exit 1 on failure, 0
otherwise

Makes for a nicer dryrun than -f + ^C, also makes it possible to wrap
with a test harness such as Test.pm

The csv patch allows DataDir to be configured to "stdout" or "stderr"
and just prints what would have been the filename (minus date stamp) =
values.  For example:
thresher/load/load=1230934282,0.000000,0.010000,0.000000
thresher/memory/memory-used=1230934282,799727616.000000
thresher/memory/memory-buffered=1230934282,675790848.000000
thresher/memory/memory-cached=1230934282,2533605376.000000
thresher/memory/memory-free=1230934282,134852608.000000

Less work during dryrun than tail + rm of the csv files, also could come
in handy for a test harness.

The 3rd patch, I had to #undef the macros when building with
--enable-debug

Thoughts?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-stdio-options-for-csv-DataDir.patch
Type: application/octet-stream
Size: 2350 bytes
Desc: 0001-stdio-options-for-csv-DataDir.patch
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090102/43257a19/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-undef-macros-before-poisoning.patch
Type: application/octet-stream
Size: 872 bytes
Desc: 0002-undef-macros-before-poisoning.patch
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090102/43257a19/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-add-T-option.patch
Type: application/octet-stream
Size: 4126 bytes
Desc: 0003-add-T-option.patch
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090102/43257a19/attachment-0002.obj 


More information about the collectd mailing list