[collectd] customizing metrics paths for various plugins

Toni Moreno toni.moreno at gmail.com
Wed Mar 11 07:15:42 CET 2015


Hi Frorin, I've done exacly what you want with collectd in two ways with
the help of 3 self made patches.

https://github.com/collectd/collectd/pull/577 ( enable add separator with a
custom character @ by example) => needed  for A
https://github.com/collectd/collectd/pull/585 ( add capacity for all
general purpose plugins to rename its name ) => needed for B


a) all OS metrics you can change with rewrite rules


PreCacheChain "ReName"
<Chain "ReName">
   <Rule "rename_processes">
     <Target "replace">
        Plugin  "\\<processes\\>" "system at processes"
     </Target>
   </Rule>
   <Rule "rename_disk">
     <Target "replace">
        Plugin  "\\<disk\\>" "system at disk"
     </Target>
   </Rule>
   <Rule "rename_cpu">
     <Target "replace">
        Plugin  "\\<cpu\\>" "system at cpu"
     </Target>
   </Rule>
   <Rule "rename_swap">
     <Target "replace">
        Plugin  "\\<swap\\>" "system at swap"
     </Target>
   </Rule>
   <Rule "rename_interface">
     <Target "replace">
        Plugin  "\\<interface\\>" "system at interface"
     </Target>
   </Rule>
   <Rule "rename_df">
     <Target "replace">
        Plugin  "\\<df\\>" "system at fs"
     </Target>
   </Rule>
   <Rule "rename_memory">
     <Target "replace">
        Plugin  "\\<memory\\>" "system at memory"
     </Target>
  </Rule>

 </Chain>

this is like it looks

https://cloud.githubusercontent.com/assets/5883405/4300595/878777aa-3e46-11e4-8b64-1c32ead6e80b.png


b)  GeneralPurpose Plugins (ie: tail plugin) can change its name depending
on the monitored product ( ie: weblogic server).

in that case you need only by each monitored file add a "RenamePluginAs"
parameter

this is like it looks after

https://cloud.githubusercontent.com/assets/5883405/5263501/120aa2ea-7a32-11e4-94ed-b96fb586398d.png


feel free to test is and I can help you if you need it.


2015-03-11 3:55 GMT+01:00 Tom Throckmorton <throck at gmail.com>:

> On Fri, Mar 6, 2015 at 9:28 PM, Florin Andrei <florin at andrei.myip.org>
> wrote:
>
>> New to this project, I am testing collectd as a metrics collector to be
>> used with Graphite. Everything's fine so far, and I am very impressed with
>> how easy it is to collect high-frequency samples with very low CPU usage.
>>
>> I've enabled the CPU plugin and the metrics are showing up in Graphite.
>> But each individual metric is prefixed with "cpu-":
>>
>> collectdlocalhostcollectd/
>> ├── cpu-0
>> │   ├── cpu-idle.wsp
>> │   ├── cpu-interrupt.wsp
>> │   ├── cpu-nice.wsp
>> │   ├── cpu-softirq.wsp
>> │   ├── cpu-steal.wsp
>> │   ├── cpu-system.wsp
>> │   ├── cpu-user.wsp
>> │   └── cpu-wait.wsp
>>
>> This seems redundant, and when visualized with Grafana, it takes too much
>> space in the legend. Is there a way to get rid of the "cpu-" prefix in the
>> metrics names? Let's say for the user metric, I want the path to be...
>>
>> host.cpu-0.user
>>
>> ...instead of...
>>
>> host.cpu-0.cpu-user
>>
>> Same question for the memory plugin.
>>
>> For the load plugin, the path is load.load.longterm - here the load label
>> appears on two different levels. Can I get rid of one level?
>>
>> Also, is there a way to group some plugins under the same branch? I'd
>> like CPU, memory, load, etc to fall under the category "os". Other plugins,
>> such as Apache, etc. I'd like to group under the "app" category.
>>
>> host
>>   os
>>     cpu
>>     memory
>>     load
>>   app
>>     apache
>>
>> It's not clear to me how to manipulate these paths with collectd.
>>
>
>
> I don't think there is a simple way to manipulate the paths for every
> plugin (other than toggling SeparateInstances) to your liking; more to the
> point, since you are using graphite, I don't think you need to.  You could
> use carbon's rewrite rules feature to force the metrics into the paths of
> your choosing - great example of rules for doing exactly some of what you
> are asking for here:
>
>
> https://github.com/indygreg/collectd-carbon/blob/master/examples/carbon.rewrite-rules.conf
>
> cheers,
>
> -tt
>
> --
>> Florin Andrei
>> http://florin.myip.org/
>>
>> _______________________________________________
>> 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/20150311/95ff9c33/attachment.html>


More information about the collectd mailing list