Hi Håkon, On Fri, Aug 06, 2010 at 01:22:53PM +0200, Florian Forster wrote: > On Thu, Aug 05, 2010 at 04:37:45PM +0200, hakon-dugstad.john...@telenor.com > wrote: > > collectd-flush is a small command-line utility which uses > > libcollectdclient to flush collectd through the unixsock plugin. […] > > I am no C wizard, so please bear with me if I have done something a > > stupid way. :) > > Your code looks fine to me :) I've found one missing "break", but that's > it. I'm a bit concerned about using "getopt_long", since - to the best > of my knowledge - that's a GNU extension and not portable. Unless I'm > mistaken I will probably remove the long option names and go back to > "getopt".
Yes, that's a GNU extension. I've removed the long options and done a bit of more hacking on that tool and turned it into a more powerful frontend to libcollectdclient. The tool is now called ‘collectdctl’ (collectd control interface). You can find the code in my ‘sh/next’ branch in my Git repo [1]. The calling syntax now looks similar to the text-based protocol used by the ‘unixsock’ plugin itself, i.e.: collectdctl <command> [command options] E.g.: collectdctl -s /path/to/unixsock flush host/foo/bar or collectdctl listval Some possible TODOs: * Add support for "PUTVAL" and "PUTNOTIF". The latter would have to be added to libcollectclient first. The former is a bit hard to implement since lcc_putval() expects the data-type to be passed along with the data-set. Not sure yet, how to properly solve that. * Add an interactive mode (similar to a shell) and support reading multiple commands from a file (script). This will require properly parsing input lines. This is already done in utils_cmd_* and the appropriate code should probably be factored out for that. * More testing ;-) Any feedback, suggestions, etc. would be very appreciated. Cheers, Sebastian [1] git://git.tokkee.org/collectd.git -- Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/ Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
signature.asc
Description: Digital signature
_______________________________________________ collectd mailing list collectd@verplant.org http://mailman.verplant.org/listinfo/collectd