I added some numeric features recently for this specific case.

Here's an example:
https://github.com/prometheus/snmp_exporter/blob/15269c2a5788db885178a8f98de28e7ce10ed0a9/generator/generator.yml#L848-L851

On Thu, Mar 27, 2025 at 1:20 AM 'Elliott Balsley' via Prometheus Users <
[email protected]> wrote:

> Some SNMP devices return boolean values as a TruthValue textual
> convention, where 1 means true and 2 means false.  This is confusing to me,
> because with most other devices I usually use 0 to mean false.  I tried
> using regex to change 2 to 0 (shown below) but this didn't work.  How do
> other folks handle TruthValues with snmp-exporter?
>
>       cdcp4415RgbIlsInstalled:
>         regex_extracts:
>           '':
>             - regex: '2'
>               value: 1
>
> This is how the value looks with net-snmp:
>
> % snmpwalk -v2c -c public 10.37.154.146
> CDS-PJTR-CP4415RGB::cdcp4415RgbIlsInstalled
>
> CDS-PJTR-CP4415RGB::cdcp4415RgbIlsInstalled.0 = INTEGER: true(1)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/prometheus-users/5c5cc8e4-2353-44b4-b41c-05208835800fn%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/5c5cc8e4-2353-44b4-b41c-05208835800fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/prometheus-users/CABbyFmoyf%3DeCHHxsqbNajVUCJS0%2BgGuDgkr6gpvGRS5mLY0dZQ%40mail.gmail.com.

Reply via email to