> Hi, everyone. I want to drop some specific metrics by its value or its label value. For example:
> 1. the temperature metrics which values are 65535 meaning it's invalid
> 2. the power metrics which "entPhysicalClass" label vale are not "6" and "9"
Metric relabeling can be used to drop specific timeseries in the scrape response by label value, but not by metric value.
The only way I can think of dropping by metric value (without changing the exporter output) is to use a
recording rule to make a modified version of the timeseries, e.g.
expr: some_temperature != 65535
If you are happy to hack snmp.yml, you could try something like this (untested):
regex_extracts:
"":
- value: NaN
regex: ^65535$
- value: $1
regex: ^(.+)$
regex_extracts:
"":
- value: INVALID
regex: ^65535$
- value: $1
regex: ^(.+)$
although this will cause snmp_exporter to generate noisy logs at debug level.
Aside: if you look through the examples you can see regex being used to divide a value by 10 (or by 100), e.g.:
regex_extracts:
"":
- value: $1.$2
regex: ^(?:(.*)(.))$
> I write the snmp.yml without generator, didn't find a specification of its syntax, does somebody know where it is?
Having said that, you may just want to run the generator and look at its output to see what it emits :-)