[collectd] GenericJMX replace whitespace

Poil poil at quake.fr
Fri Jul 6 18:09:55 CEST 2012


NoNoNo that was bad :x

The only way I have found is to do this ...

LoadPlugin "target_replace"
<Chain "PostCache">
<Rule "strip_space">
    <Target "replace">
      PluginInstance " " "_"
      PluginInstance " " "_"
      PluginInstance " " "_"
      PluginInstance " " "_"
    </Target>
    <Target "write">
      Plugin "network"
   </Target>
  </Rule>
</Chain>



Le 06/07/2012 16:10, Benjamin DUPUIS a écrit :
> I've got it, but I need to add a "default rules" other while others plugins aren't written.
> And I have to do a postcache, precache does nothing :(
>
>
> LoadPlugin java
> LoadPlugin "target_replace"
> <Plugin "java">
>    # required JVM argument is the classpath
>    # JVMArg "-Djava.class.path=/installpath/collectd/share/collectd/java"
>    # Since version 4.8.4 (commit c983405) the API and GenericJMX plugin are
>    # provided as .jar files.
>    JVMARG "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar:/usr/share/collectd/java/generic-jmx.jar"
>    LoadPlugin "org.collectd.java.GenericJMX"
>   
>    <Plugin "GenericJMX">
>      # Memory usage by memory pool.
>      <MBean "memory_pool">
>        ObjectName "java.lang:type=MemoryPool,*"
>        InstancePrefix "memory_pool-"
>        InstanceFrom "name"
>        <Value>
>          Type "memory"
>          #InstancePrefix ""
>          #InstanceFrom ""
>          Table true
>          Attribute "Usage"
>        </Value>
>      </MBean>
>   
>      <Connection>
>        Host "doc01t"
>        ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:8086/jmxrmi"
>        Collect "memory_pool"
>      </Connection>
>    </Plugin>
> </Plugin>
>   LoadPlugin "target_replace"
> <Chain "PostCache">
> <Rule "strip_space">
>     <Match "regex">
>       Plugin "GenericJMX"
>     </Match>
>     <Target "replace">
>       PluginInstance " " "_"
>       PluginInstance " " "_"
>       PluginInstance " " "_"
>       PluginInstance " " "_"
>     </Target>
> </Rule>
> <Rule "other">
> </Rule>
> </Chain>
>
>
> ----- Message d'origine -----
> De: Benjamin DUPUIS <benjamin.dupuis at quake.fr>
> Date: Fri, 06 Jul 2012 13:52:27 +0200
> Sujet: Re: [collectd] GenericJMX replace whitespace
> À: poil at own-you.com, collectd at verplant.org
>
>> I've got something better
>>
>> LoadPlugin "target_replace"
>> <Chain "PostCache">
>> <Rule "strip_space">
>>    <Match "regex">
>>      Plugin "GenericJMX"
>>    </Match>
>>    <Target "replace">
>>      PluginInstance " " "_"
>>    </Target>
>>    <Target "write">
>>       Plugin "network"
>>    </Target>
>>    Target "stop"
>> </Rule>
>> </Chain>
>>
>>
>> But only the first whitespace is replaced
>> "GenericJMX-memory_pool-PS Eden Space" ==> "GenericJMX-memory_pool-PS_Eden Space"
>>
>> Any idea ?
>>
>> Best regards
>>
>> ----- Message d'origine -----
>> De: Poil <poil at own-you.com>
>> Date: Fri, 06 Jul 2012 11:11:36 +0200
>> Sujet: [collectd] GenericJMX replace whitespace
>> À: collectd at verplant.org
>>
>>> Hi,
>>>
>>> I'm trying to replace whitespace in PluginInstance on Plugin GenericJMX
>>> Example : "GenericJMX-memory_pool-Code Cache" must be "GenericJMX-memory_pool-Code_Cache"
>>>
>>> So I've tried this but this is doing nothing.
>>>
>>> ########################################"
>>> LoadPlugin java
>>> LoadPlugin "target_replace"
>>> <Plugin "java">
>>>   # required JVM argument is the classpath
>>>   # JVMArg "-Djava.class.path=/installpath/collectd/share/collectd/java"
>>>   # Since version 4.8.4 (commit c983405) the API and GenericJMX plugin are
>>>   # provided as .jar files.
>>>   JVMARG "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar:/usr/share/collectd/java/generic-jmx.jar"
>>>   LoadPlugin "org.collectd.java.GenericJMX"
>>>   
>>>   <Plugin "GenericJMX">
>>>     # Memory usage by memory pool.
>>>     <MBean "memory_pool">
>>>       ObjectName "java.lang:type=MemoryPool,*"
>>>       InstancePrefix "memory_pool-"
>>>       InstanceFrom "name"
>>>       <Value>
>>>         Type "memory"
>>>         #InstancePrefix ""
>>>         #InstanceFrom ""
>>>         Table true
>>>         Attribute "Usage"
>>>       </Value>
>>>     </MBean>
>>>
>>>     <Connection>
>>>       Host "doc01t"
>>>       ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:8086/jmxrmi"
>>>       Collect "memory_pool"
>>>     </Connection>
>>>   </Plugin>
>>> </Plugin>
>>>
>>> <Chain "PreCache">
>>> <Rule "strip_space">
>>>    <Match "regex">
>>>      Plugin "GenericJMX"
>>>    </Match>
>>>    <Target "replace">
>>>      PluginInstance " " "_"
>>>    </Target>
>>> </Rule>
>>> </Chain>
>>> ########################################"
>>>
>>> In logfile I've got only this which is speaking about replace
>>> [2012-07-06 11:07:48] type = java
>>> [2012-07-06 11:07:48] type = target_replace
>>> [2012-07-06 11:07:48] fc_register_target (replace);
>>> [2012-07-06 11:07:48] type = target_replace
>>> [2012-07-06 11:07:48] fc_register_target (replace);
>>>
>>>
>>> Note : I'm using network plugin and there is no rules on the target server
>>>
>>> Any help ? :)
>>>
>>> Best regards,
>>>
>>> _______________________________________________
>>> collectd mailing list
>>> collectd at verplant.org
>>> http://mailman.verplant.org/listinfo/collectd
>>>
>>





More information about the collectd mailing list