Limit SNMP Datacollection by Table Index



I have a vendor MIB that exposes a lot of data. I only care about maybe 1/16th of the rows in the table, though.

I’m looking at the PersistRegexSelectorStrategy in the datacollection configuration, but I’m not seeing any way to limit based upon the index. I’ve tried expressions like “(#index matches ‘.1.8$’)”, but get errors like:

WARN  [Collectd-Thread-6-of-50] o.o.n.c.PersistRegexSelectorStrategy: shouldPersist: can't evaluate expression (#index matches '\.1\.8$')  for resource node[219].fooEntry[4016.1.8] because: EL1037E:(pos 1): First operand to matches operator must be a string. 'null' is not

Is there a subtle trick to do what I’m looking for here (only match entries in the “foo” table if the index ends in “.1.8”) with the built in PersistRegexSelectorStrategy? Or would I need to write a new PersistenceSelectorStrategy implementation to handle this case?


It looks #index is not available in the expression context of the PersistRegexSelectorStrategy - only string attributes that are collected are added. See

Can you share a copy the data collection group you have configured?


I’m checking to see if I can distribute that config or the MIB it’s from.

But, none of columns in the SNMP Table I’m looking at are strings (they’re either counters Counter64 or INTEGER syntax enums), and it doesn’t seem that most of the components of this compound index are included in the row “object”, either; they’re just in the index.

Looks like I may want to send a patch to add the “resource instance” to the evaluation context for the PersistRegexSelectorStrategy, like this?

        EvaluatorContextVisitor visitor = new EvaluatorContextVisitor();
        // allow matching against index data in some form
        visitor.getEvaluationContext().setVariable("instance", resource.getInstance());


Yeah, that should work.