[collectd] Patch for collecting global average CPU on linux boxes.

Toni Moreno toni.moreno at gmail.com
Thu Nov 21 10:42:14 CET 2013


I've done a Pull request

https://github.com/collectd/collectd/pull/478

Hi Yves , I've done in this way because I thingh is the fastest way..
sysconf() seems to count cores in a similar way  (
http://heidydogdog.appspot.com/?p=105001 ) .

But you can after improve it when pull request accepted if you want.

Lots of thanks.


2013/11/20 Yves Mettier <ymettier at free.fr>

> Hello,
>
> I fully agree with such a patch : I have a similar patch (
> https://github.com/perfwatcher/collectd-pw/tree/patch/cpu/src - I forgot
> to submit it).
>
> I also suggest that both percent and jiffies be available because of the
> aggregation plugin(s).
>
> I was wondering why you need /proc/cpuinfo...
> Cannot you use this ?
>
> int numcpu = sysconf( _SC_NPROCESSORS_ONLN );
>
> About my patch : https://github.com/perfwatcher/collectd-pw/tree/
> patch/cpu/src : I decided to use percents instead of jiffies. Maybe
> that's why I did not submit it ?
> However, please read it and take the best of it into your patch !
>
> Regards,
> Yves
>
>
> ---
> - Homepage       - http://ymettier.free.fr                             -
> - GPG key        - http://ymettier.free.fr/gpg.txt                     -
> - C en action    - http://ymettier.free.fr/livres/C_en_action_ed2.html -
> - Guide Survie C - http://www.pearson.fr/livre/?GCOI=27440100673730    -
>
> Le 2013-11-18 17:31, Otis Gospodnetic a écrit :
>
>> Sounds good to me.  Thanks for sharing!
>>
>> Otis
>> --
>> Performance Monitoring * Log Analytics * Search Analytics
>> Solr & Elasticsearch Support * http://sematext.com/
>>
>>
>> On Mon, Nov 18, 2013 at 3:30 AM, Toni Moreno <toni.moreno at gmail.com>
>> wrote:
>>
>>  Hi Otis.
>>>
>>> I think this approach is much better in very big servers ( I usually work
>>> in servers with up to 40 cores ) and is easier to parse a single line on
>>> /proc/stats than calculate 40* 8 ( metrics/core) averages values.
>>>
>>> It also makes to have simpler config files ( avoiding average plugin).
>>>
>>> I will do a pull request in next days on this week.
>>>
>>> Thanks a lot !!
>>>
>>>
>>> 2013/11/16 Otis Gospodnetic <otis.gospodnetic at gmail.com>
>>>
>>>  Hi Toni,
>>>>
>>>> Would it be better to issue a PR at https://github.com/collectd/
>>>> collectdinstead?
>>>>
>>>> Q: why is this approach better than using the aggregate functionality?
>>>>
>>>> Thanks,
>>>> Otis
>>>> --
>>>> Performance Monitoring * Log Analytics * Search Analytics
>>>> Solr & Elasticsearch Support * http://sematext.com/
>>>>
>>>>
>>>> On Wed, Nov 6, 2013 at 8:24 AM, Toni Moreno <toni.moreno at gmail.com
>>>> >wrote:
>>>>
>>>>  Hi.
>>>>>
>>>>> I've been working on get global average CPU , from the cpu plugin
>>>>> better
>>>>> than use the "aggregate" to get the same values.
>>>>>
>>>>> I've attached a patch for the cpu plugin.
>>>>>
>>>>> with this patch you will get a new  "plugin-instance" named  "global" ,
>>>>> with  % average of all cpu cores .
>>>>>
>>>>> I've obtained these values from the same proc file that cpu plugin uses
>>>>> for  the other cores.
>>>>>
>>>>> NOTE: This patch is only for linux.
>>>>>
>>>>>
>>>>> I hope you can enjoy it
>>>>>
>>>>>
>>>>>
>>>>>
>> _______________________________________________
>> 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
>



-- 

Att

Toni Moreno

699706656



*Si no quieres perderte en el olvido tan pronto como estés muerto y
corrompido, *

*escribe cosas dignas de leerse, o haz cosas dignas de escribirse.*



*Benjamin Franklin*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20131121/caf3a1e6/attachment.html>


More information about the collectd mailing list