[collectd] Need advice: Perl or Pyhon for writing plugins?

Mariusz Gronczewski xani666 at gmail.com
Sat Jun 18 02:18:46 CEST 2011


Well, there is always SUID root ;). Perl is supported from version 4.0,
python from 4.9 so I guess perl plugin is more "mature", tho i dont think it
matters for that kind of hack. But please don't leave that as only option,
any sysadmin worth his salt will prefer to have that kind of things either
in cron or logrotate. Or make plugin simple, like
"system('/some/where/rotate_metic')" so it can be used standalone

2011/6/17 O G <otis_junk at yahoo.com>

> Hello,
>
> Hm, would exec plugin work? I was under the impression that:
>
> * Collectd has to run as root
> * Exec plugin has to run as non-root user: "If the daemon runs as root, you
> *have to* configure another user ID with which the new process is
> created." from http://collectd.org/wiki/index.php/Plugin:Exec
>
> Because of the above, the script running as exec plugin wouldn't have the
> privileges to remove root-owned files collectd created.
>
> So our original questions are:
>
> 1) Is either Perl or Python plugin support available in all collectd
> packages or at least collectd packages the most popular Linux distros use?
>
> 2) Should we use Perl or Python for this - are they equal in terms of
> capabilities, limitations, and being updated with every collectd release?
> Many thanks,
> Otis
>
>
> *From:* Mariusz Gronczewski <xani666 at gmail.com>
> *To:* O G <otis_junk at yahoo.com>
> *Cc:* ""collectd at verplant.org"" <collectd at verplant.org>
> *Sent:* Friday, June 17, 2011 12:31 PM
> *Subject:* Re: [collectd] Need advice: Perl or Pyhon for writing plugins?
> **
> Well simplest would be just running (any) program using "exec" plugin...
> collectd will just restart it when it dies**But then logrotate is pretty
> much standard for any linux boxes and it's included in repo of most UNIX-es,
> why reinvent the wheel ? Or use cron ('add one line here' is not too hard
> even for pretty dumb clients ;))** **
> 2011/6/16 O G <otis_junk at yahoo.com>**
>
> Hello,
>
> By "collectd-generated files/logs" I really mean files with metric info
> that collectd generates, like this for example:
>
> $ ls -al cpu-0/cpu-idle-2011-06-***-rw-r--r-- 1 root root 180986
> 2011-06-14 23:59 cpu-0/cpu-idle-2011-06-14**-rw-r--r-- 1 root root 180987
> 2011-06-15 23:59 cpu-0/cpu-idle-2011-06-15**-rw-r--r-- 1 root root 129827
> 2011-06-16 17:14 cpu-0/cpu-idle-2011-06-16
>
> The thinking behind writing a collectd plugin that removes old files like
> those above is precisely to eliminate the need for external tool (which
> needs to be installed and/or configured).  We have a performance monitoring
> service (see http://sematext.com/spm/index.html ) that requires users to
> install collectd on their servers (because we get info about CPU, disk, etc.
> from collectd).  We want to minimize what they need to install or configure
> on their own, so instead of telling them "Hey, you need to install logrotate
> and use our logrotate config file and make sure this is run from cron every
> night...", we would like to have a "collectd plugin for collectd old file
> removal" that ships with our software and that collectd would just
> automatically run, thus making our users' lives simpler.
>
> Is there a better or simpler way to achieve this?
> Maybe I need to start a separate thread on this subject...
>
> Thanks,
> Otis
>
>
>  *From:* XANi <xani666 at gmail.com>
> *To:* O G <otis_junk at yahoo.com>
> *Cc:* "collectd at verplant.org" <collectd at verplant.org>
> *Sent:* Wednesday, June 15, 2011 5:54 PM
> *Subject:* Re: [collectd] Need advice: Perl or Pyhon for writing plugins?
> **
> Dnia 2011-06-14, wto o godzinie 10:39 -0700, O G pisze:
>
> Hello,
>
> My team and I are interested in writing a plugin that cleans old collectd-generated files/logs (so we don't have to rely on an external config/tool like logrotate to clean up after collectd).  We've written such a plugin in Java, but discovered that Java plugin support is not included in all/many collectd packages out there, so we can't count on this working for all Linux distros, for example.
>
> Thus, we are now considering writing this plugin in either Perl or Python.
>
> So our questions are:
>
> 1) Is either Perl or Python plugin support available in all collectd packages or at least collectd packages the most popular Linux distros use?
>
> 2) Should we use Perl or Python for this - are they equal in terms of capabilities, limitations, and being updated with every collectd release?
>
> Any help would be *greatly* appreciated.
>
> Thanks,
> Otis
>
>  What exactly do you mean by "collectd-generated files/logs" ? daemon logs,
> .rrd files, both or something else.** And why it have to be collectd
> plugin, you can make standalone program and just communicate via unixsock
> with collectd.** **
>
> --
> Mariusz Gronczewski (XANi) <xani666 at gmail.com>
> GnuPG: 0xEA8ACE64http://devrandom.pl
>
>   ****
>
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> http://mailman.verplant.org/listinfo/collectd
>
> **
> ****
>
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> http://mailman.verplant.org/listinfo/collectd
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110618/1b01c6c0/attachment.htm>


More information about the collectd mailing list