[collectd] Need help for filter

Tom Throckmorton throck at gmail.com
Fri Jan 4 17:38:48 CET 2013


On Fri, Jan 4, 2013 at 11:25 AM, Tom Throckmorton <throck at gmail.com> wrote:

> On Fri, Jan 4, 2013 at 2:24 AM, AUVINET Andre <
> Andre.AUVINET at nantesmetropole.fr> wrote:
>
>> **
>> Hi,
>>
>> Thank you for your answer.
>> No, I would like to filter more interfaces.
>>
>> The idea is to examine a table an to filter the result.
>>
>> For example , filter the inteface mgmt but leave other.
>>
>
> Ah, sorry for misunderstanding.  It looks like this will work:
>
>  LoadPlugin "match_regex"
>  PreCacheChain "PreCache"
>  <Chain "PreCache">
>    <Rule "ignore_loopback">
>      <Match "regex">
>        Plugin "^snmp$"
>        TypeInstance "^Loopback0"
>      </Match>
>      Target "return"
>    </Rule>
>      Target "stop"
>  </Chain>
>
> This example filters out all Types for Loopback0
>

Whoops, that was inverted, and matched only Loopback0 - should be:

 LoadPlugin "match_regex"
 PreCacheChain "PreCache"
 <Chain "PreCache">
   <Rule "ignore_loopback">
     <Match "regex">
       Plugin "^snmp$"
       TypeInstance "^Loopback0"
     </Match>
     Target "stop"
   </Rule>
     Target "return"
 </Chain>

-tt




> .  The TypeInstance matches the ifDescr; you can also specify a Type to
> exclude collection for specific Data elements
>
> -tt
>
>
>
>>
>> Cordially,
>>
>>
>>
>>
>>
>>
>> *André Auvinet*
>> Technicien réseaux & télécoms
>> Département général des ressources numériques
>> Nantes Métropole et Ville de Nantes
>> Tour Bretagne
>> 44923 Nantes cedex 9
>> Tél. 02 40 99 93 59
>> Fax. 02 40 20 38 48
>>
>>
>>
>>
>>
>>  ------------------------------
>> *De :* Tom Throckmorton [mailto:throck at gmail.com]
>> *Envoyé :* jeudi 3 janvier 2013 18:09
>> *À :* Bill Schwanitz; AUVINET Andre
>> *Cc :* collectd at verplant.org
>> *Objet :* Re: [collectd] Need help for filter
>>
>>  On Thu, Jan 3, 2013 at 10:33 AM, Bill Schwanitz <bilsch at gmail.com>wrote:
>>
>>>
>>> On Jan 3, 2013, at 10:15 AM, AUVINET Andre <
>>> Andre.AUVINET at nantesmetropole.fr> wrote:
>>>
>>> > Yes,  I want "stop" target for interfaces I did not need.
>>> >
>>> >
>>> > Something like :
>>> >
>>> > LoadPlugin "SNMP"
>>> > <Chain "PreCache">
>>> >  <Rule "Ignore_interfaces">
>>> >    <Match "regex">
>>> >      Plugin "^snmp$"
>>> >      Type "if_octets"                >>>> I don't know
>>> >       TypeInstance ""                >>>> I don't know
>>> >    </Match>
>>> >     <Target "stop">
>>> >     </Target>
>>> >  </Rule>
>>> >  Target "write"
>>> >  /Target
>>> > </Chain>
>>>
>>> Type is probably going to be your IF-MIB::ifOctets.526846912
>>>
>>> Do you know how to find the interface index?
>>> $ snmpwalk -v2c -c foo_comm_string foo_host IF-MIB::ifName
>>> IF-MIB::ifName.526846656 = STRING: Ethernet104/1/44
>>> IF-MIB::ifName.526846720 = STRING: Ethernet104/1/45
>>> IF-MIB::ifName.526846784 = STRING: Ethernet104/1/46
>>> IF-MIB::ifName.526846848 = STRING: Ethernet104/1/47
>>> IF-MIB::ifName.526846912 = STRING: Ethernet104/1/48
>>>  (…)
>>>
>>> I imagine you are going to need that. Its probably going to be dropped
>>> in to TypeInstance value whole like this
>>>
>>> TypeInstance "IF-MIB::ifName.526846912"
>>>
>>> again, just a guess - this is kinda new to me. I'm adding this back to
>>> the mailing list in case anyone else is more familiar.
>>>
>>
>>  I haven't tried filtering, but if you only need data for a single
>> interface, then it can be done without the filter; in the 'Data' definition
>> within the snmp plugin config, just specify the OID+index in the 'Values'
>> and set 'Table' to false, which will lead to only the data for that
>> interface being pulled rather than the plugin parsing the ifTable.
>>  Assuming the index of that interface is 12345 on both chassis, something
>> like:
>>
>>    <Data "ifmib_if_octets32">
>>     Type "if_octets"
>>     Table false
>>     Instance "te-0-1"
>>     Values "IF-MIB::ifInOctets.12345" "IF-MIB::ifOutOctets.12345"
>>  </Data>
>>
>>    <Host "Nexus_5548_1">
>>     Address "172.20.0.30"
>>     Version 2
>>     Community "public"
>>     Collect "ifmib_if_octets32.12345" "ifmib_if_errors32.12345"
>>     Interval 120
>>   </Host>
>>   <Host "Nexus_5548_2">
>>     Address "172.20.0.31"
>>     Version 2
>>     Community "public"
>>     Collect "ifmib_if_octets32.12345" "ifmib_if_errors32.12345"
>>     Interval 120
>>   </Host>
>>
>>  The instance will be appended to the value list, so in this example
>> you'd end up with rrd filenames like 'ifmib_if_octets32-te-0-1', though you
>> may also leave the instance blank.
>>
>>  Cheers,
>>
>>  -tt
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20130104/47a6db9a/attachment.html>


More information about the collectd mailing list